ChimeraTK-ControlSystemAdapter-OPCUAAdapter  02.00.03
open62541.c
Go to the documentation of this file.
1 /* THIS IS A SINGLE-FILE DISTRIBUTION CONCATENATED FROM THE OPEN62541 SOURCES
2  * visit http://open62541.org/ for information about this software
3  * Git-Revision: v0.2.2
4  */
5 
6 /*
7  * Copyright (C) 2014-2016 the contributors as stated in the AUTHORS file
8  *
9  * This file is part of open62541. open62541 is free software: you can
10  * redistribute it and/or modify it under the terms of the Mozilla Public
11  * License v2.0 as stated in the LICENSE file provided with open62541.
12  *
13  * open62541 is distributed in the hope that it will be useful, but WITHOUT ANY
14  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15  * A PARTICULAR PURPOSE.
16  */
17 
18 #ifndef UA_DYNAMIC_LINKING_EXPORT
19 # define UA_DYNAMIC_LINKING_EXPORT
20 #endif
21 
22 #include "open62541.h"
23 
24 /*********************************** amalgamated original file "/home/iosb/sw/open62541/deps/queue.h" ***********************************/
25 
26 /* $OpenBSD: queue.h,v 1.38 2013/07/03 15:05:21 fgsch Exp $ */
27 /* $NetBSD: queue.h,v 1.11 1996/05/16 05:17:14 mycroft Exp $ */
28 
29 /*
30  * Copyright (c) 1991, 1993
31  * The Regents of the University of California. All rights reserved.
32  *
33  * Redistribution and use in source and binary forms, with or without
34  * modification, are permitted provided that the following conditions
35  * are met:
36  * 1. Redistributions of source code must retain the above copyright
37  * notice, this list of conditions and the following disclaimer.
38  * 2. Redistributions in binary form must reproduce the above copyright
39  * notice, this list of conditions and the following disclaimer in the
40  * documentation and/or other materials provided with the distribution.
41  * 3. Neither the name of the University nor the names of its contributors
42  * may be used to endorse or promote products derived from this software
43  * without specific prior written permission.
44  *
45  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
46  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
47  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
48  * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
49  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
50  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
51  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
52  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
53  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
54  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
55  * SUCH DAMAGE.
56  *
57  * @(#)queue.h 8.5 (Berkeley) 8/20/94
58  */
59 
60 #ifndef _SYS_QUEUE_H_
61 #define _SYS_QUEUE_H_
62 
63 /*
64  * This file defines five types of data structures: singly-linked lists,
65  * lists, simple queues, tail queues, and circular queues.
66  *
67  *
68  * A singly-linked list is headed by a single forward pointer. The elements
69  * are singly linked for minimum space and pointer manipulation overhead at
70  * the expense of O(n) removal for arbitrary elements. New elements can be
71  * added to the list after an existing element or at the head of the list.
72  * Elements being removed from the head of the list should use the explicit
73  * macro for this purpose for optimum efficiency. A singly-linked list may
74  * only be traversed in the forward direction. Singly-linked lists are ideal
75  * for applications with large datasets and few or no removals or for
76  * implementing a LIFO queue.
77  *
78  * A list is headed by a single forward pointer (or an array of forward
79  * pointers for a hash table header). The elements are doubly linked
80  * so that an arbitrary element can be removed without a need to
81  * traverse the list. New elements can be added to the list before
82  * or after an existing element or at the head of the list. A list
83  * may only be traversed in the forward direction.
84  *
85  * A simple queue is headed by a pair of pointers, one the head of the
86  * list and the other to the tail of the list. The elements are singly
87  * linked to save space, so elements can only be removed from the
88  * head of the list. New elements can be added to the list before or after
89  * an existing element, at the head of the list, or at the end of the
90  * list. A simple queue may only be traversed in the forward direction.
91  *
92  * A tail queue is headed by a pair of pointers, one to the head of the
93  * list and the other to the tail of the list. The elements are doubly
94  * linked so that an arbitrary element can be removed without a need to
95  * traverse the list. New elements can be added to the list before or
96  * after an existing element, at the head of the list, or at the end of
97  * the list. A tail queue may be traversed in either direction.
98  *
99  * A circle queue is headed by a pair of pointers, one to the head of the
100  * list and the other to the tail of the list. The elements are doubly
101  * linked so that an arbitrary element can be removed without a need to
102  * traverse the list. New elements can be added to the list before or after
103  * an existing element, at the head of the list, or at the end of the list.
104  * A circle queue may be traversed in either direction, but has a more
105  * complex end of list detection.
106  *
107  * For details on the use of these macros, see the queue(3) manual page.
108  */
109 
110 #if defined(QUEUE_MACRO_DEBUG) || (defined(_KERNEL) && defined(DIAGNOSTIC))
111 #define _Q_INVALIDATE(a) (a) = ((void *)-1)
112 #else
113 #define _Q_INVALIDATE(a)
114 #endif
115 
116 /*
117  * Singly-linked List definitions.
118  */
119 #define SLIST_HEAD(name, type) \
120 struct name { \
121  struct type *slh_first; /* first element */ \
122 }
123 
124 #define SLIST_HEAD_INITIALIZER(head) \
125  { NULL }
126 
127 /* Fix redefinition of SLIST_ENTRY on mingw winnt.h */
128 # ifdef SLIST_ENTRY
129 # undef SLIST_ENTRY
130 # endif
131 
132 #define SLIST_ENTRY(type) \
133 struct { \
134  struct type *sle_next; /* next element */ \
135 }
136 
137 /*
138  * Singly-linked List access methods.
139  */
140 #define SLIST_FIRST(head) ((head)->slh_first)
141 #define SLIST_END(head) NULL
142 #define SLIST_EMPTY(head) (SLIST_FIRST(head) == SLIST_END(head))
143 #define SLIST_NEXT(elm, field) ((elm)->field.sle_next)
144 
145 #define SLIST_FOREACH(var, head, field) \
146  for((var) = SLIST_FIRST(head); \
147  (var) != SLIST_END(head); \
148  (var) = SLIST_NEXT(var, field))
149 
150 #define SLIST_FOREACH_SAFE(var, head, field, tvar) \
151  for ((var) = SLIST_FIRST(head); \
152  (var) && ((tvar) = SLIST_NEXT(var, field), 1); \
153  (var) = (tvar))
154 
155 /*
156  * Singly-linked List functions.
157  */
158 #define SLIST_INIT(head) { \
159  SLIST_FIRST(head) = SLIST_END(head); \
160 }
161 
162 #define SLIST_INSERT_AFTER(slistelm, elm, field) do { \
163  (elm)->field.sle_next = (slistelm)->field.sle_next; \
164  (slistelm)->field.sle_next = (elm); \
165 } while (0)
166 
167 #define SLIST_INSERT_HEAD(head, elm, field) do { \
168  (elm)->field.sle_next = (head)->slh_first; \
169  (head)->slh_first = (elm); \
170 } while (0)
171 
172 #define SLIST_REMOVE_AFTER(elm, field) do { \
173  (elm)->field.sle_next = (elm)->field.sle_next->field.sle_next; \
174 } while (0)
175 
176 #define SLIST_REMOVE_HEAD(head, field) do { \
177  (head)->slh_first = (head)->slh_first->field.sle_next; \
178 } while (0)
179 
180 #define SLIST_REMOVE(head, elm, type, field) do { \
181  if ((head)->slh_first == (elm)) { \
182  SLIST_REMOVE_HEAD((head), field); \
183  } else { \
184  struct type *curelm = (head)->slh_first; \
185  \
186  while (curelm->field.sle_next != (elm)) \
187  curelm = curelm->field.sle_next; \
188  curelm->field.sle_next = \
189  curelm->field.sle_next->field.sle_next; \
190  _Q_INVALIDATE((elm)->field.sle_next); \
191  } \
192 } while (0)
193 
194 /*
195  * List definitions.
196  */
197 #define LIST_HEAD(name, type) \
198 struct name { \
199  struct type *lh_first; /* first element */ \
200 }
201 
202 #define LIST_HEAD_INITIALIZER(head) \
203  { NULL }
204 
205 #define LIST_ENTRY(type) \
206 struct { \
207  struct type *le_next; /* next element */ \
208  struct type **le_prev; /* address of previous next element */ \
209 }
210 
211 /*
212  * List access methods
213  */
214 #define LIST_FIRST(head) ((head)->lh_first)
215 #define LIST_END(head) NULL
216 #define LIST_EMPTY(head) (LIST_FIRST(head) == LIST_END(head))
217 #define LIST_NEXT(elm, field) ((elm)->field.le_next)
218 
219 #define LIST_FOREACH(var, head, field) \
220  for((var) = LIST_FIRST(head); \
221  (var)!= LIST_END(head); \
222  (var) = LIST_NEXT(var, field))
223 
224 #define LIST_FOREACH_SAFE(var, head, field, tvar) \
225  for ((var) = LIST_FIRST(head); \
226  (var) && ((tvar) = LIST_NEXT(var, field), 1); \
227  (var) = (tvar))
228 
229 /*
230  * List functions.
231  */
232 #define LIST_INIT(head) do { \
233  LIST_FIRST(head) = LIST_END(head); \
234 } while (0)
235 
236 #define LIST_INSERT_AFTER(listelm, elm, field) do { \
237  if (((elm)->field.le_next = (listelm)->field.le_next) != NULL) \
238  (listelm)->field.le_next->field.le_prev = \
239  &(elm)->field.le_next; \
240  (listelm)->field.le_next = (elm); \
241  (elm)->field.le_prev = &(listelm)->field.le_next; \
242 } while (0)
243 
244 #define LIST_INSERT_BEFORE(listelm, elm, field) do { \
245  (elm)->field.le_prev = (listelm)->field.le_prev; \
246  (elm)->field.le_next = (listelm); \
247  *(listelm)->field.le_prev = (elm); \
248  (listelm)->field.le_prev = &(elm)->field.le_next; \
249 } while (0)
250 
251 #define LIST_INSERT_HEAD(head, elm, field) do { \
252  if (((elm)->field.le_next = (head)->lh_first) != NULL) \
253  (head)->lh_first->field.le_prev = &(elm)->field.le_next;\
254  (head)->lh_first = (elm); \
255  (elm)->field.le_prev = &(head)->lh_first; \
256 } while (0)
257 
258 #define LIST_REMOVE(elm, field) do { \
259  if ((elm)->field.le_next != NULL) \
260  (elm)->field.le_next->field.le_prev = \
261  (elm)->field.le_prev; \
262  *(elm)->field.le_prev = (elm)->field.le_next; \
263  _Q_INVALIDATE((elm)->field.le_prev); \
264  _Q_INVALIDATE((elm)->field.le_next); \
265 } while (0)
266 
267 #define LIST_REPLACE(elm, elm2, field) do { \
268  if (((elm2)->field.le_next = (elm)->field.le_next) != NULL) \
269  (elm2)->field.le_next->field.le_prev = \
270  &(elm2)->field.le_next; \
271  (elm2)->field.le_prev = (elm)->field.le_prev; \
272  *(elm2)->field.le_prev = (elm2); \
273  _Q_INVALIDATE((elm)->field.le_prev); \
274  _Q_INVALIDATE((elm)->field.le_next); \
275 } while (0)
276 
277 /*
278  * Simple queue definitions.
279  */
280 #define SIMPLEQ_HEAD(name, type) \
281 struct name { \
282  struct type *sqh_first; /* first element */ \
283  struct type **sqh_last; /* addr of last next element */ \
284 }
285 
286 #define SIMPLEQ_HEAD_INITIALIZER(head) \
287  { NULL, &(head).sqh_first }
288 
289 #define SIMPLEQ_ENTRY(type) \
290 struct { \
291  struct type *sqe_next; /* next element */ \
292 }
293 
294 /*
295  * Simple queue access methods.
296  */
297 #define SIMPLEQ_FIRST(head) ((head)->sqh_first)
298 #define SIMPLEQ_END(head) NULL
299 #define SIMPLEQ_EMPTY(head) (SIMPLEQ_FIRST(head) == SIMPLEQ_END(head))
300 #define SIMPLEQ_NEXT(elm, field) ((elm)->field.sqe_next)
301 
302 #define SIMPLEQ_FOREACH(var, head, field) \
303  for((var) = SIMPLEQ_FIRST(head); \
304  (var) != SIMPLEQ_END(head); \
305  (var) = SIMPLEQ_NEXT(var, field))
306 
307 #define SIMPLEQ_FOREACH_SAFE(var, head, field, tvar) \
308  for ((var) = SIMPLEQ_FIRST(head); \
309  (var) && ((tvar) = SIMPLEQ_NEXT(var, field), 1); \
310  (var) = (tvar))
311 
312 /*
313  * Simple queue functions.
314  */
315 #define SIMPLEQ_INIT(head) do { \
316  (head)->sqh_first = NULL; \
317  (head)->sqh_last = &(head)->sqh_first; \
318 } while (0)
319 
320 #define SIMPLEQ_INSERT_HEAD(head, elm, field) do { \
321  if (((elm)->field.sqe_next = (head)->sqh_first) == NULL) \
322  (head)->sqh_last = &(elm)->field.sqe_next; \
323  (head)->sqh_first = (elm); \
324 } while (0)
325 
326 #define SIMPLEQ_INSERT_TAIL(head, elm, field) do { \
327  (elm)->field.sqe_next = NULL; \
328  *(head)->sqh_last = (elm); \
329  (head)->sqh_last = &(elm)->field.sqe_next; \
330 } while (0)
331 
332 #define SIMPLEQ_INSERT_AFTER(head, listelm, elm, field) do { \
333  if (((elm)->field.sqe_next = (listelm)->field.sqe_next) == NULL)\
334  (head)->sqh_last = &(elm)->field.sqe_next; \
335  (listelm)->field.sqe_next = (elm); \
336 } while (0)
337 
338 #define SIMPLEQ_REMOVE_HEAD(head, field) do { \
339  if (((head)->sqh_first = (head)->sqh_first->field.sqe_next) == NULL) \
340  (head)->sqh_last = &(head)->sqh_first; \
341 } while (0)
342 
343 #define SIMPLEQ_REMOVE_AFTER(head, elm, field) do { \
344  if (((elm)->field.sqe_next = (elm)->field.sqe_next->field.sqe_next) \
345  == NULL) \
346  (head)->sqh_last = &(elm)->field.sqe_next; \
347 } while (0)
348 
349 /*
350  * XOR Simple queue definitions.
351  */
352 #define XSIMPLEQ_HEAD(name, type) \
353 struct name { \
354  struct type *sqx_first; /* first element */ \
355  struct type **sqx_last; /* addr of last next element */ \
356  unsigned long sqx_cookie; \
357 }
358 
359 #define XSIMPLEQ_ENTRY(type) \
360 struct { \
361  struct type *sqx_next; /* next element */ \
362 }
363 
364 /*
365  * XOR Simple queue access methods.
366  */
367 #define XSIMPLEQ_XOR(head, ptr) ((__typeof(ptr))((head)->sqx_cookie ^ \
368  (unsigned long)(ptr)))
369 #define XSIMPLEQ_FIRST(head) XSIMPLEQ_XOR(head, ((head)->sqx_first))
370 #define XSIMPLEQ_END(head) NULL
371 #define XSIMPLEQ_EMPTY(head) (XSIMPLEQ_FIRST(head) == XSIMPLEQ_END(head))
372 #define XSIMPLEQ_NEXT(head, elm, field) XSIMPLEQ_XOR(head, ((elm)->field.sqx_next))
373 
374 
375 #define XSIMPLEQ_FOREACH(var, head, field) \
376  for ((var) = XSIMPLEQ_FIRST(head); \
377  (var) != XSIMPLEQ_END(head); \
378  (var) = XSIMPLEQ_NEXT(head, var, field))
379 
380 #define XSIMPLEQ_FOREACH_SAFE(var, head, field, tvar) \
381  for ((var) = XSIMPLEQ_FIRST(head); \
382  (var) && ((tvar) = XSIMPLEQ_NEXT(head, var, field), 1); \
383  (var) = (tvar))
384 
385 /*
386  * XOR Simple queue functions.
387  */
388 #define XSIMPLEQ_INIT(head) do { \
389  arc4random_buf(&(head)->sqx_cookie, sizeof((head)->sqx_cookie)); \
390  (head)->sqx_first = XSIMPLEQ_XOR(head, NULL); \
391  (head)->sqx_last = XSIMPLEQ_XOR(head, &(head)->sqx_first); \
392 } while (0)
393 
394 #define XSIMPLEQ_INSERT_HEAD(head, elm, field) do { \
395  if (((elm)->field.sqx_next = (head)->sqx_first) == \
396  XSIMPLEQ_XOR(head, NULL)) \
397  (head)->sqx_last = XSIMPLEQ_XOR(head, &(elm)->field.sqx_next); \
398  (head)->sqx_first = XSIMPLEQ_XOR(head, (elm)); \
399 } while (0)
400 
401 #define XSIMPLEQ_INSERT_TAIL(head, elm, field) do { \
402  (elm)->field.sqx_next = XSIMPLEQ_XOR(head, NULL); \
403  *(XSIMPLEQ_XOR(head, (head)->sqx_last)) = XSIMPLEQ_XOR(head, (elm)); \
404  (head)->sqx_last = XSIMPLEQ_XOR(head, &(elm)->field.sqx_next); \
405 } while (0)
406 
407 #define XSIMPLEQ_INSERT_AFTER(head, listelm, elm, field) do { \
408  if (((elm)->field.sqx_next = (listelm)->field.sqx_next) == \
409  XSIMPLEQ_XOR(head, NULL)) \
410  (head)->sqx_last = XSIMPLEQ_XOR(head, &(elm)->field.sqx_next); \
411  (listelm)->field.sqx_next = XSIMPLEQ_XOR(head, (elm)); \
412 } while (0)
413 
414 #define XSIMPLEQ_REMOVE_HEAD(head, field) do { \
415  if (((head)->sqx_first = XSIMPLEQ_XOR(head, \
416  (head)->sqx_first)->field.sqx_next) == XSIMPLEQ_XOR(head, NULL)) \
417  (head)->sqx_last = XSIMPLEQ_XOR(head, &(head)->sqx_first); \
418 } while (0)
419 
420 #define XSIMPLEQ_REMOVE_AFTER(head, elm, field) do { \
421  if (((elm)->field.sqx_next = XSIMPLEQ_XOR(head, \
422  (elm)->field.sqx_next)->field.sqx_next) \
423  == XSIMPLEQ_XOR(head, NULL)) \
424  (head)->sqx_last = \
425  XSIMPLEQ_XOR(head, &(elm)->field.sqx_next); \
426 } while (0)
427 
428 
429 /*
430  * Tail queue definitions.
431  */
432 #define TAILQ_HEAD(name, type) \
433 struct name { \
434  struct type *tqh_first; /* first element */ \
435  struct type **tqh_last; /* addr of last next element */ \
436 }
437 
438 #define TAILQ_HEAD_INITIALIZER(head) \
439  { NULL, &(head).tqh_first }
440 
441 #define TAILQ_ENTRY(type) \
442 struct { \
443  struct type *tqe_next; /* next element */ \
444  struct type **tqe_prev; /* address of previous next element */ \
445 }
446 
447 /*
448  * tail queue access methods
449  */
450 #define TAILQ_FIRST(head) ((head)->tqh_first)
451 #define TAILQ_END(head) NULL
452 #define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next)
453 #define TAILQ_LAST(head, headname) \
454  (*(((struct headname *)((head)->tqh_last))->tqh_last))
455 /* XXX */
456 #define TAILQ_PREV(elm, headname, field) \
457  (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last))
458 #define TAILQ_EMPTY(head) \
459  (TAILQ_FIRST(head) == TAILQ_END(head))
460 
461 #define TAILQ_FOREACH(var, head, field) \
462  for((var) = TAILQ_FIRST(head); \
463  (var) != TAILQ_END(head); \
464  (var) = TAILQ_NEXT(var, field))
465 
466 #define TAILQ_FOREACH_SAFE(var, head, field, tvar) \
467  for ((var) = TAILQ_FIRST(head); \
468  (var) != TAILQ_END(head) && \
469  ((tvar) = TAILQ_NEXT(var, field), 1); \
470  (var) = (tvar))
471 
472 
473 #define TAILQ_FOREACH_REVERSE(var, head, headname, field) \
474  for((var) = TAILQ_LAST(head, headname); \
475  (var) != TAILQ_END(head); \
476  (var) = TAILQ_PREV(var, headname, field))
477 
478 #define TAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, tvar) \
479  for ((var) = TAILQ_LAST(head, headname); \
480  (var) != TAILQ_END(head) && \
481  ((tvar) = TAILQ_PREV(var, headname, field), 1); \
482  (var) = (tvar))
483 
484 /*
485  * Tail queue functions.
486  */
487 #define TAILQ_INIT(head) do { \
488  (head)->tqh_first = NULL; \
489  (head)->tqh_last = &(head)->tqh_first; \
490 } while (0)
491 
492 #define TAILQ_INSERT_HEAD(head, elm, field) do { \
493  if (((elm)->field.tqe_next = (head)->tqh_first) != NULL) \
494  (head)->tqh_first->field.tqe_prev = \
495  &(elm)->field.tqe_next; \
496  else \
497  (head)->tqh_last = &(elm)->field.tqe_next; \
498  (head)->tqh_first = (elm); \
499  (elm)->field.tqe_prev = &(head)->tqh_first; \
500 } while (0)
501 
502 #define TAILQ_INSERT_TAIL(head, elm, field) do { \
503  (elm)->field.tqe_next = NULL; \
504  (elm)->field.tqe_prev = (head)->tqh_last; \
505  *(head)->tqh_last = (elm); \
506  (head)->tqh_last = &(elm)->field.tqe_next; \
507 } while (0)
508 
509 #define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \
510  if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != NULL)\
511  (elm)->field.tqe_next->field.tqe_prev = \
512  &(elm)->field.tqe_next; \
513  else \
514  (head)->tqh_last = &(elm)->field.tqe_next; \
515  (listelm)->field.tqe_next = (elm); \
516  (elm)->field.tqe_prev = &(listelm)->field.tqe_next; \
517 } while (0)
518 
519 #define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \
520  (elm)->field.tqe_prev = (listelm)->field.tqe_prev; \
521  (elm)->field.tqe_next = (listelm); \
522  *(listelm)->field.tqe_prev = (elm); \
523  (listelm)->field.tqe_prev = &(elm)->field.tqe_next; \
524 } while (0)
525 
526 #define TAILQ_REMOVE(head, elm, field) do { \
527  if (((elm)->field.tqe_next) != NULL) \
528  (elm)->field.tqe_next->field.tqe_prev = \
529  (elm)->field.tqe_prev; \
530  else \
531  (head)->tqh_last = (elm)->field.tqe_prev; \
532  *(elm)->field.tqe_prev = (elm)->field.tqe_next; \
533  _Q_INVALIDATE((elm)->field.tqe_prev); \
534  _Q_INVALIDATE((elm)->field.tqe_next); \
535 } while (0)
536 
537 #define TAILQ_REPLACE(head, elm, elm2, field) do { \
538  if (((elm2)->field.tqe_next = (elm)->field.tqe_next) != NULL) \
539  (elm2)->field.tqe_next->field.tqe_prev = \
540  &(elm2)->field.tqe_next; \
541  else \
542  (head)->tqh_last = &(elm2)->field.tqe_next; \
543  (elm2)->field.tqe_prev = (elm)->field.tqe_prev; \
544  *(elm2)->field.tqe_prev = (elm2); \
545  _Q_INVALIDATE((elm)->field.tqe_prev); \
546  _Q_INVALIDATE((elm)->field.tqe_next); \
547 } while (0)
548 
549 /*
550  * Circular queue definitions.
551  */
552 #define CIRCLEQ_HEAD(name, type) \
553 struct name { \
554  struct type *cqh_first; /* first element */ \
555  struct type *cqh_last; /* last element */ \
556 }
557 
558 #define CIRCLEQ_HEAD_INITIALIZER(head) \
559  { CIRCLEQ_END(&head), CIRCLEQ_END(&head) }
560 
561 #define CIRCLEQ_ENTRY(type) \
562 struct { \
563  struct type *cqe_next; /* next element */ \
564  struct type *cqe_prev; /* previous element */ \
565 }
566 
567 /*
568  * Circular queue access methods
569  */
570 #define CIRCLEQ_FIRST(head) ((head)->cqh_first)
571 #define CIRCLEQ_LAST(head) ((head)->cqh_last)
572 #define CIRCLEQ_END(head) ((void *)(head))
573 #define CIRCLEQ_NEXT(elm, field) ((elm)->field.cqe_next)
574 #define CIRCLEQ_PREV(elm, field) ((elm)->field.cqe_prev)
575 #define CIRCLEQ_EMPTY(head) \
576  (CIRCLEQ_FIRST(head) == CIRCLEQ_END(head))
577 
578 #define CIRCLEQ_FOREACH(var, head, field) \
579  for((var) = CIRCLEQ_FIRST(head); \
580  (var) != CIRCLEQ_END(head); \
581  (var) = CIRCLEQ_NEXT(var, field))
582 
583 #define CIRCLEQ_FOREACH_SAFE(var, head, field, tvar) \
584  for ((var) = CIRCLEQ_FIRST(head); \
585  (var) != CIRCLEQ_END(head) && \
586  ((tvar) = CIRCLEQ_NEXT(var, field), 1); \
587  (var) = (tvar))
588 
589 #define CIRCLEQ_FOREACH_REVERSE(var, head, field) \
590  for((var) = CIRCLEQ_LAST(head); \
591  (var) != CIRCLEQ_END(head); \
592  (var) = CIRCLEQ_PREV(var, field))
593 
594 #define CIRCLEQ_FOREACH_REVERSE_SAFE(var, head, headname, field, tvar) \
595  for ((var) = CIRCLEQ_LAST(head, headname); \
596  (var) != CIRCLEQ_END(head) && \
597  ((tvar) = CIRCLEQ_PREV(var, headname, field), 1); \
598  (var) = (tvar))
599 
600 /*
601  * Circular queue functions.
602  */
603 #define CIRCLEQ_INIT(head) do { \
604  (head)->cqh_first = CIRCLEQ_END(head); \
605  (head)->cqh_last = CIRCLEQ_END(head); \
606 } while (0)
607 
608 #define CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) do { \
609  (elm)->field.cqe_next = (listelm)->field.cqe_next; \
610  (elm)->field.cqe_prev = (listelm); \
611  if ((listelm)->field.cqe_next == CIRCLEQ_END(head)) \
612  (head)->cqh_last = (elm); \
613  else \
614  (listelm)->field.cqe_next->field.cqe_prev = (elm); \
615  (listelm)->field.cqe_next = (elm); \
616 } while (0)
617 
618 #define CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) do { \
619  (elm)->field.cqe_next = (listelm); \
620  (elm)->field.cqe_prev = (listelm)->field.cqe_prev; \
621  if ((listelm)->field.cqe_prev == CIRCLEQ_END(head)) \
622  (head)->cqh_first = (elm); \
623  else \
624  (listelm)->field.cqe_prev->field.cqe_next = (elm); \
625  (listelm)->field.cqe_prev = (elm); \
626 } while (0)
627 
628 #define CIRCLEQ_INSERT_HEAD(head, elm, field) do { \
629  (elm)->field.cqe_next = (head)->cqh_first; \
630  (elm)->field.cqe_prev = CIRCLEQ_END(head); \
631  if ((head)->cqh_last == CIRCLEQ_END(head)) \
632  (head)->cqh_last = (elm); \
633  else \
634  (head)->cqh_first->field.cqe_prev = (elm); \
635  (head)->cqh_first = (elm); \
636 } while (0)
637 
638 #define CIRCLEQ_INSERT_TAIL(head, elm, field) do { \
639  (elm)->field.cqe_next = CIRCLEQ_END(head); \
640  (elm)->field.cqe_prev = (head)->cqh_last; \
641  if ((head)->cqh_first == CIRCLEQ_END(head)) \
642  (head)->cqh_first = (elm); \
643  else \
644  (head)->cqh_last->field.cqe_next = (elm); \
645  (head)->cqh_last = (elm); \
646 } while (0)
647 
648 #define CIRCLEQ_REMOVE(head, elm, field) do { \
649  if ((elm)->field.cqe_next == CIRCLEQ_END(head)) \
650  (head)->cqh_last = (elm)->field.cqe_prev; \
651  else \
652  (elm)->field.cqe_next->field.cqe_prev = \
653  (elm)->field.cqe_prev; \
654  if ((elm)->field.cqe_prev == CIRCLEQ_END(head)) \
655  (head)->cqh_first = (elm)->field.cqe_next; \
656  else \
657  (elm)->field.cqe_prev->field.cqe_next = \
658  (elm)->field.cqe_next; \
659  _Q_INVALIDATE((elm)->field.cqe_prev); \
660  _Q_INVALIDATE((elm)->field.cqe_next); \
661 } while (0)
662 
663 #define CIRCLEQ_REPLACE(head, elm, elm2, field) do { \
664  if (((elm2)->field.cqe_next = (elm)->field.cqe_next) == \
665  CIRCLEQ_END(head)) \
666  (head)->cqh_last = (elm2); \
667  else \
668  (elm2)->field.cqe_next->field.cqe_prev = (elm2); \
669  if (((elm2)->field.cqe_prev = (elm)->field.cqe_prev) == \
670  CIRCLEQ_END(head)) \
671  (head)->cqh_first = (elm2); \
672  else \
673  (elm2)->field.cqe_prev->field.cqe_next = (elm2); \
674  _Q_INVALIDATE((elm)->field.cqe_prev); \
675  _Q_INVALIDATE((elm)->field.cqe_next); \
676 } while (0)
677 
678 #endif /* !_SYS_QUEUE_H_ */
679 
680 /*********************************** amalgamated original file "/home/iosb/sw/open62541/deps/pcg_basic.h" ***********************************/
681 
682 /*
683  * PCG Random Number Generation for C.
684  *
685  * Copyright 2014 Melissa O'Neill <oneill@pcg-random.org>
686  *
687  * Licensed under the Apache License, Version 2.0 (the "License");
688  * you may not use this file except in compliance with the License.
689  * You may obtain a copy of the License at
690  *
691  * http://www.apache.org/licenses/LICENSE-2.0
692  *
693  * Unless required by applicable law or agreed to in writing, software
694  * distributed under the License is distributed on an "AS IS" BASIS,
695  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
696  * See the License for the specific language governing permissions and
697  * limitations under the License.
698  *
699  * For additional information about the PCG random number generation scheme,
700  * including its license and other licensing options, visit
701  *
702  * http://www.pcg-random.org
703  */
704 
705 
706 
707 #if __cplusplus
708 extern "C" {
709 #endif
710 
711 typedef struct pcg_state_setseq_64 {
712  uint64_t state; // RNG state. All values are possible.
713  uint64_t inc; // Controls which RNG sequence (stream) is selected. Must *always* be odd.
715 
716 #define PCG32_INITIALIZER { 0x853c49e6748fea9bULL, 0xda3e39cb94b95bdbULL }
717 
718 void pcg32_srandom_r(pcg32_random_t* rng, uint64_t initial_state, uint64_t initseq);
719 uint32_t pcg32_random_r(pcg32_random_t* rng);
720 
721 #if __cplusplus
722 }
723 #endif
724 
725 
726 /*********************************** amalgamated original file "/home/iosb/sw/open62541/deps/libc_time.h" ***********************************/
727 
728 
729 #include <limits.h>
730 #include <time.h>
731 int __secs_to_tm(long long t, struct tm *tm);
732 
733 
734 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/ua_util.h" ***********************************/
735 
736 /* This Source Code Form is subject to the terms of the Mozilla Public
737 * License, v. 2.0. If a copy of the MPL was not distributed with this
738 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
739 
740 
741 
742 /* Assert */
743 #include <assert.h>
744 #define UA_assert(ignore) assert(ignore)
745 
746 /* BSD Queue Macros */
747 
748 /* container_of */
749 #define container_of(ptr, type, member) \
750  (type *)((uintptr_t)ptr - offsetof(type,member))
751 
752 /* Thread-Local Storage
753  * --------------------
754  * Thread-local variables are always enabled. Also when the library is built
755  * with ``UA_ENABLE_MULTITHREADING`` disabled. Otherwise, if multiple clients
756  * run in separate threads, race conditions may occur via global variables in
757  * the encoding layer. */
758 #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
759 # define UA_THREAD_LOCAL _Thread_local /* C11 */
760 #elif defined(__GNUC__)
761 # define UA_THREAD_LOCAL __thread /* GNU extension */
762 #elif defined(_MSC_VER)
763 # define UA_THREAD_LOCAL __declspec(thread) /* MSVC extension */
764 #else
765 # warning The compiler does not support thread-local variables
766 # define UA_THREAD_LOCAL
767 #endif
768 
769 /* Integer Shortnames
770  * ------------------
771  * These are not exposed on the public API, since many user-applications make
772  * the same definitions in their headers. */
773 typedef UA_Byte u8;
774 typedef UA_SByte i8;
775 typedef UA_UInt16 u16;
776 typedef UA_Int16 i16;
777 typedef UA_UInt32 u32;
778 typedef UA_Int32 i32;
779 typedef UA_UInt64 u64;
780 typedef UA_Int64 i64;
782 
783 /* Atomic Operations
784  * -----------------
785  * Atomic operations that synchronize across processor cores (for
786  * multithreading). Only the inline-functions defined next are used. Replace
787  * with architecture-specific operations if necessary. */
788 #ifndef UA_ENABLE_MULTITHREADING
789 # define UA_atomic_sync()
790 #else
791 # ifdef _MSC_VER /* Visual Studio */
792 # define UA_atomic_sync() _ReadWriteBarrier()
793 # else /* GCC/Clang */
794 # define UA_atomic_sync() __sync_synchronize()
795 # endif
796 #endif
797 
798 static UA_INLINE void *
799 UA_atomic_xchg(void * volatile * addr, void *newptr) {
800 #ifndef UA_ENABLE_MULTITHREADING
801  void *old = *addr;
802  *addr = newptr;
803  return old;
804 #else
805 # ifdef _MSC_VER /* Visual Studio */
806  return _InterlockedExchangePointer(addr, newptr);
807 # else /* GCC/Clang */
808  return __sync_lock_test_and_set(addr, newptr);
809 # endif
810 #endif
811 }
812 
813 static UA_INLINE void *
814 UA_atomic_cmpxchg(void * volatile * addr, void *expected, void *newptr) {
815 #ifndef UA_ENABLE_MULTITHREADING
816  void *old = *addr;
817  if(old == expected) {
818  *addr = newptr;
819  }
820  return old;
821 #else
822 # ifdef _MSC_VER /* Visual Studio */
823  return _InterlockedCompareExchangePointer(addr, expected, newptr);
824 # else /* GCC/Clang */
825  return __sync_val_compare_and_swap(addr, expected, newptr);
826 # endif
827 #endif
828 }
829 
830 static UA_INLINE uint32_t
831 UA_atomic_add(volatile uint32_t *addr, uint32_t increase) {
832 #ifndef UA_ENABLE_MULTITHREADING
833  *addr += increase;
834  return *addr;
835 #else
836 # ifdef _MSC_VER /* Visual Studio */
837  return _InterlockedExchangeAdd(addr, increase) + increase;
838 # else /* GCC/Clang */
839  return __sync_add_and_fetch(addr, increase);
840 # endif
841 #endif
842 }
843 
844 
845 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/ua_types_encoding_binary.h" ***********************************/
846 
847 /* This Source Code Form is subject to the terms of the Mozilla Public
848 * License, v. 2.0. If a copy of the MPL was not distributed with this
849 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
850 
851 
852 
853 typedef UA_StatusCode (*UA_exchangeEncodeBuffer)(void *handle, UA_ByteString *buf, size_t offset);
854 
856 UA_encodeBinary(const void *src, const UA_DataType *type,
857  UA_exchangeEncodeBuffer exchangeCallback, void *exchangeHandle,
858  UA_ByteString *dst, size_t *offset) UA_FUNC_ATTR_WARN_UNUSED_RESULT;
859 
861 UA_decodeBinary(const UA_ByteString *src, size_t *offset, void *dst,
863 
864 size_t UA_calcSizeBinary(void *p, const UA_DataType *type);
865 
866 
867 /*********************************** amalgamated original file "/home/iosb/sw/open62541/build/src_generated/ua_types_generated_encoding_binary.h" ***********************************/
868 
869 /* Generated from Opc.Ua.Types.bsd with script /home/iosb/sw/open62541/tools/generate_datatypes.py
870  * on host iosb-VirtualBox by user iosb at 2018-11-29 10:33:07 */
871 
872 
873 /* Boolean */
875 UA_Boolean_encodeBinary(const UA_Boolean *src, UA_ByteString *dst, size_t *offset) {
876  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_BOOLEAN], NULL, NULL, dst, offset);
877 }
879 UA_Boolean_decodeBinary(const UA_ByteString *src, size_t *offset, UA_Boolean *dst) {
880  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_BOOLEAN]);
881 }
882 
883 /* SByte */
885 UA_SByte_encodeBinary(const UA_SByte *src, UA_ByteString *dst, size_t *offset) {
886  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_SBYTE], NULL, NULL, dst, offset);
887 }
889 UA_SByte_decodeBinary(const UA_ByteString *src, size_t *offset, UA_SByte *dst) {
890  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_SBYTE]);
891 }
892 
893 /* Byte */
895 UA_Byte_encodeBinary(const UA_Byte *src, UA_ByteString *dst, size_t *offset) {
896  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_BYTE], NULL, NULL, dst, offset);
897 }
899 UA_Byte_decodeBinary(const UA_ByteString *src, size_t *offset, UA_Byte *dst) {
900  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_BYTE]);
901 }
902 
903 /* Int16 */
905 UA_Int16_encodeBinary(const UA_Int16 *src, UA_ByteString *dst, size_t *offset) {
906  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_INT16], NULL, NULL, dst, offset);
907 }
909 UA_Int16_decodeBinary(const UA_ByteString *src, size_t *offset, UA_Int16 *dst) {
910  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_INT16]);
911 }
912 
913 /* UInt16 */
915 UA_UInt16_encodeBinary(const UA_UInt16 *src, UA_ByteString *dst, size_t *offset) {
916  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_UINT16], NULL, NULL, dst, offset);
917 }
919 UA_UInt16_decodeBinary(const UA_ByteString *src, size_t *offset, UA_UInt16 *dst) {
920  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_UINT16]);
921 }
922 
923 /* Int32 */
925 UA_Int32_encodeBinary(const UA_Int32 *src, UA_ByteString *dst, size_t *offset) {
926  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_INT32], NULL, NULL, dst, offset);
927 }
929 UA_Int32_decodeBinary(const UA_ByteString *src, size_t *offset, UA_Int32 *dst) {
930  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_INT32]);
931 }
932 
933 /* UInt32 */
935 UA_UInt32_encodeBinary(const UA_UInt32 *src, UA_ByteString *dst, size_t *offset) {
936  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_UINT32], NULL, NULL, dst, offset);
937 }
939 UA_UInt32_decodeBinary(const UA_ByteString *src, size_t *offset, UA_UInt32 *dst) {
940  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_UINT32]);
941 }
942 
943 /* Int64 */
945 UA_Int64_encodeBinary(const UA_Int64 *src, UA_ByteString *dst, size_t *offset) {
946  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_INT64], NULL, NULL, dst, offset);
947 }
949 UA_Int64_decodeBinary(const UA_ByteString *src, size_t *offset, UA_Int64 *dst) {
950  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_INT64]);
951 }
952 
953 /* UInt64 */
955 UA_UInt64_encodeBinary(const UA_UInt64 *src, UA_ByteString *dst, size_t *offset) {
956  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_UINT64], NULL, NULL, dst, offset);
957 }
959 UA_UInt64_decodeBinary(const UA_ByteString *src, size_t *offset, UA_UInt64 *dst) {
960  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_UINT64]);
961 }
962 
963 /* Float */
965 UA_Float_encodeBinary(const UA_Float *src, UA_ByteString *dst, size_t *offset) {
966  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_FLOAT], NULL, NULL, dst, offset);
967 }
969 UA_Float_decodeBinary(const UA_ByteString *src, size_t *offset, UA_Float *dst) {
970  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_FLOAT]);
971 }
972 
973 /* Double */
975 UA_Double_encodeBinary(const UA_Double *src, UA_ByteString *dst, size_t *offset) {
976  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DOUBLE], NULL, NULL, dst, offset);
977 }
979 UA_Double_decodeBinary(const UA_ByteString *src, size_t *offset, UA_Double *dst) {
980  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DOUBLE]);
981 }
982 
983 /* String */
985 UA_String_encodeBinary(const UA_String *src, UA_ByteString *dst, size_t *offset) {
986  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_STRING], NULL, NULL, dst, offset);
987 }
989 UA_String_decodeBinary(const UA_ByteString *src, size_t *offset, UA_String *dst) {
990  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_STRING]);
991 }
992 
993 /* DateTime */
995 UA_DateTime_encodeBinary(const UA_DateTime *src, UA_ByteString *dst, size_t *offset) {
996  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DATETIME], NULL, NULL, dst, offset);
997 }
999 UA_DateTime_decodeBinary(const UA_ByteString *src, size_t *offset, UA_DateTime *dst) {
1000  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DATETIME]);
1001 }
1002 
1003 /* Guid */
1004 static UA_INLINE UA_StatusCode
1005 UA_Guid_encodeBinary(const UA_Guid *src, UA_ByteString *dst, size_t *offset) {
1006  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_GUID], NULL, NULL, dst, offset);
1007 }
1008 static UA_INLINE UA_StatusCode
1009 UA_Guid_decodeBinary(const UA_ByteString *src, size_t *offset, UA_Guid *dst) {
1010  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_GUID]);
1011 }
1012 
1013 /* ByteString */
1014 static UA_INLINE UA_StatusCode
1015 UA_ByteString_encodeBinary(const UA_ByteString *src, UA_ByteString *dst, size_t *offset) {
1016  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_BYTESTRING], NULL, NULL, dst, offset);
1017 }
1018 static UA_INLINE UA_StatusCode
1019 UA_ByteString_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ByteString *dst) {
1020  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_BYTESTRING]);
1021 }
1022 
1023 /* XmlElement */
1024 static UA_INLINE UA_StatusCode
1025 UA_XmlElement_encodeBinary(const UA_XmlElement *src, UA_ByteString *dst, size_t *offset) {
1026  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_XMLELEMENT], NULL, NULL, dst, offset);
1027 }
1028 static UA_INLINE UA_StatusCode
1029 UA_XmlElement_decodeBinary(const UA_ByteString *src, size_t *offset, UA_XmlElement *dst) {
1030  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_XMLELEMENT]);
1031 }
1032 
1033 /* NodeId */
1034 static UA_INLINE UA_StatusCode
1035 UA_NodeId_encodeBinary(const UA_NodeId *src, UA_ByteString *dst, size_t *offset) {
1036  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_NODEID], NULL, NULL, dst, offset);
1037 }
1038 static UA_INLINE UA_StatusCode
1039 UA_NodeId_decodeBinary(const UA_ByteString *src, size_t *offset, UA_NodeId *dst) {
1040  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_NODEID]);
1041 }
1042 
1043 /* ExpandedNodeId */
1044 static UA_INLINE UA_StatusCode
1045 UA_ExpandedNodeId_encodeBinary(const UA_ExpandedNodeId *src, UA_ByteString *dst, size_t *offset) {
1046  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_EXPANDEDNODEID], NULL, NULL, dst, offset);
1047 }
1048 static UA_INLINE UA_StatusCode
1049 UA_ExpandedNodeId_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ExpandedNodeId *dst) {
1050  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_EXPANDEDNODEID]);
1051 }
1052 
1053 /* StatusCode */
1054 static UA_INLINE UA_StatusCode
1055 UA_StatusCode_encodeBinary(const UA_StatusCode *src, UA_ByteString *dst, size_t *offset) {
1056  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_STATUSCODE], NULL, NULL, dst, offset);
1057 }
1058 static UA_INLINE UA_StatusCode
1059 UA_StatusCode_decodeBinary(const UA_ByteString *src, size_t *offset, UA_StatusCode *dst) {
1060  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_STATUSCODE]);
1061 }
1062 
1063 /* QualifiedName */
1064 static UA_INLINE UA_StatusCode
1065 UA_QualifiedName_encodeBinary(const UA_QualifiedName *src, UA_ByteString *dst, size_t *offset) {
1066  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_QUALIFIEDNAME], NULL, NULL, dst, offset);
1067 }
1068 static UA_INLINE UA_StatusCode
1069 UA_QualifiedName_decodeBinary(const UA_ByteString *src, size_t *offset, UA_QualifiedName *dst) {
1070  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_QUALIFIEDNAME]);
1071 }
1072 
1073 /* LocalizedText */
1074 static UA_INLINE UA_StatusCode
1075 UA_LocalizedText_encodeBinary(const UA_LocalizedText *src, UA_ByteString *dst, size_t *offset) {
1076  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_LOCALIZEDTEXT], NULL, NULL, dst, offset);
1077 }
1078 static UA_INLINE UA_StatusCode
1079 UA_LocalizedText_decodeBinary(const UA_ByteString *src, size_t *offset, UA_LocalizedText *dst) {
1080  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_LOCALIZEDTEXT]);
1081 }
1082 
1083 /* ExtensionObject */
1084 static UA_INLINE UA_StatusCode
1085 UA_ExtensionObject_encodeBinary(const UA_ExtensionObject *src, UA_ByteString *dst, size_t *offset) {
1086  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_EXTENSIONOBJECT], NULL, NULL, dst, offset);
1087 }
1088 static UA_INLINE UA_StatusCode
1089 UA_ExtensionObject_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ExtensionObject *dst) {
1090  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_EXTENSIONOBJECT]);
1091 }
1092 
1093 /* DataValue */
1094 static UA_INLINE UA_StatusCode
1095 UA_DataValue_encodeBinary(const UA_DataValue *src, UA_ByteString *dst, size_t *offset) {
1096  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DATAVALUE], NULL, NULL, dst, offset);
1097 }
1098 static UA_INLINE UA_StatusCode
1099 UA_DataValue_decodeBinary(const UA_ByteString *src, size_t *offset, UA_DataValue *dst) {
1100  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DATAVALUE]);
1101 }
1102 
1103 /* Variant */
1104 static UA_INLINE UA_StatusCode
1105 UA_Variant_encodeBinary(const UA_Variant *src, UA_ByteString *dst, size_t *offset) {
1106  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_VARIANT], NULL, NULL, dst, offset);
1107 }
1108 static UA_INLINE UA_StatusCode
1109 UA_Variant_decodeBinary(const UA_ByteString *src, size_t *offset, UA_Variant *dst) {
1110  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_VARIANT]);
1111 }
1112 
1113 /* DiagnosticInfo */
1114 static UA_INLINE UA_StatusCode
1115 UA_DiagnosticInfo_encodeBinary(const UA_DiagnosticInfo *src, UA_ByteString *dst, size_t *offset) {
1116  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DIAGNOSTICINFO], NULL, NULL, dst, offset);
1117 }
1118 static UA_INLINE UA_StatusCode
1119 UA_DiagnosticInfo_decodeBinary(const UA_ByteString *src, size_t *offset, UA_DiagnosticInfo *dst) {
1120  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DIAGNOSTICINFO]);
1121 }
1122 
1123 /* SignedSoftwareCertificate */
1124 static UA_INLINE UA_StatusCode
1125 UA_SignedSoftwareCertificate_encodeBinary(const UA_SignedSoftwareCertificate *src, UA_ByteString *dst, size_t *offset) {
1127 }
1128 static UA_INLINE UA_StatusCode
1129 UA_SignedSoftwareCertificate_decodeBinary(const UA_ByteString *src, size_t *offset, UA_SignedSoftwareCertificate *dst) {
1130  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_SIGNEDSOFTWARECERTIFICATE]);
1131 }
1132 
1133 /* BrowsePathTarget */
1134 static UA_INLINE UA_StatusCode
1135 UA_BrowsePathTarget_encodeBinary(const UA_BrowsePathTarget *src, UA_ByteString *dst, size_t *offset) {
1136  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_BROWSEPATHTARGET], NULL, NULL, dst, offset);
1137 }
1138 static UA_INLINE UA_StatusCode
1139 UA_BrowsePathTarget_decodeBinary(const UA_ByteString *src, size_t *offset, UA_BrowsePathTarget *dst) {
1140  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_BROWSEPATHTARGET]);
1141 }
1142 
1143 /* ViewAttributes */
1144 static UA_INLINE UA_StatusCode
1145 UA_ViewAttributes_encodeBinary(const UA_ViewAttributes *src, UA_ByteString *dst, size_t *offset) {
1146  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_VIEWATTRIBUTES], NULL, NULL, dst, offset);
1147 }
1148 static UA_INLINE UA_StatusCode
1149 UA_ViewAttributes_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ViewAttributes *dst) {
1150  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_VIEWATTRIBUTES]);
1151 }
1152 
1153 /* BrowseResultMask */
1154 static UA_INLINE UA_StatusCode
1155 UA_BrowseResultMask_encodeBinary(const UA_BrowseResultMask *src, UA_ByteString *dst, size_t *offset) {
1156  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_BROWSERESULTMASK], NULL, NULL, dst, offset);
1157 }
1158 static UA_INLINE UA_StatusCode
1159 UA_BrowseResultMask_decodeBinary(const UA_ByteString *src, size_t *offset, UA_BrowseResultMask *dst) {
1160  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_BROWSERESULTMASK]);
1161 }
1162 
1163 /* RequestHeader */
1164 static UA_INLINE UA_StatusCode
1165 UA_RequestHeader_encodeBinary(const UA_RequestHeader *src, UA_ByteString *dst, size_t *offset) {
1166  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_REQUESTHEADER], NULL, NULL, dst, offset);
1167 }
1168 static UA_INLINE UA_StatusCode
1169 UA_RequestHeader_decodeBinary(const UA_ByteString *src, size_t *offset, UA_RequestHeader *dst) {
1170  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_REQUESTHEADER]);
1171 }
1172 
1173 /* MonitoredItemModifyResult */
1174 static UA_INLINE UA_StatusCode
1175 UA_MonitoredItemModifyResult_encodeBinary(const UA_MonitoredItemModifyResult *src, UA_ByteString *dst, size_t *offset) {
1177 }
1178 static UA_INLINE UA_StatusCode
1179 UA_MonitoredItemModifyResult_decodeBinary(const UA_ByteString *src, size_t *offset, UA_MonitoredItemModifyResult *dst) {
1180  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_MONITOREDITEMMODIFYRESULT]);
1181 }
1182 
1183 /* CloseSecureChannelRequest */
1184 static UA_INLINE UA_StatusCode
1185 UA_CloseSecureChannelRequest_encodeBinary(const UA_CloseSecureChannelRequest *src, UA_ByteString *dst, size_t *offset) {
1187 }
1188 static UA_INLINE UA_StatusCode
1189 UA_CloseSecureChannelRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_CloseSecureChannelRequest *dst) {
1190  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CLOSESECURECHANNELREQUEST]);
1191 }
1192 
1193 /* AddNodesResult */
1194 static UA_INLINE UA_StatusCode
1195 UA_AddNodesResult_encodeBinary(const UA_AddNodesResult *src, UA_ByteString *dst, size_t *offset) {
1196  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_ADDNODESRESULT], NULL, NULL, dst, offset);
1197 }
1198 static UA_INLINE UA_StatusCode
1199 UA_AddNodesResult_decodeBinary(const UA_ByteString *src, size_t *offset, UA_AddNodesResult *dst) {
1200  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_ADDNODESRESULT]);
1201 }
1202 
1203 /* VariableAttributes */
1204 static UA_INLINE UA_StatusCode
1205 UA_VariableAttributes_encodeBinary(const UA_VariableAttributes *src, UA_ByteString *dst, size_t *offset) {
1206  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_VARIABLEATTRIBUTES], NULL, NULL, dst, offset);
1207 }
1208 static UA_INLINE UA_StatusCode
1209 UA_VariableAttributes_decodeBinary(const UA_ByteString *src, size_t *offset, UA_VariableAttributes *dst) {
1210  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_VARIABLEATTRIBUTES]);
1211 }
1212 
1213 /* NotificationMessage */
1214 static UA_INLINE UA_StatusCode
1215 UA_NotificationMessage_encodeBinary(const UA_NotificationMessage *src, UA_ByteString *dst, size_t *offset) {
1216  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_NOTIFICATIONMESSAGE], NULL, NULL, dst, offset);
1217 }
1218 static UA_INLINE UA_StatusCode
1219 UA_NotificationMessage_decodeBinary(const UA_ByteString *src, size_t *offset, UA_NotificationMessage *dst) {
1220  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_NOTIFICATIONMESSAGE]);
1221 }
1222 
1223 /* NodeAttributesMask */
1224 static UA_INLINE UA_StatusCode
1225 UA_NodeAttributesMask_encodeBinary(const UA_NodeAttributesMask *src, UA_ByteString *dst, size_t *offset) {
1226  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_NODEATTRIBUTESMASK], NULL, NULL, dst, offset);
1227 }
1228 static UA_INLINE UA_StatusCode
1229 UA_NodeAttributesMask_decodeBinary(const UA_ByteString *src, size_t *offset, UA_NodeAttributesMask *dst) {
1230  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_NODEATTRIBUTESMASK]);
1231 }
1232 
1233 /* MonitoringMode */
1234 static UA_INLINE UA_StatusCode
1235 UA_MonitoringMode_encodeBinary(const UA_MonitoringMode *src, UA_ByteString *dst, size_t *offset) {
1236  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_MONITORINGMODE], NULL, NULL, dst, offset);
1237 }
1238 static UA_INLINE UA_StatusCode
1239 UA_MonitoringMode_decodeBinary(const UA_ByteString *src, size_t *offset, UA_MonitoringMode *dst) {
1240  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_MONITORINGMODE]);
1241 }
1242 
1243 /* CallMethodResult */
1244 static UA_INLINE UA_StatusCode
1245 UA_CallMethodResult_encodeBinary(const UA_CallMethodResult *src, UA_ByteString *dst, size_t *offset) {
1246  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_CALLMETHODRESULT], NULL, NULL, dst, offset);
1247 }
1248 static UA_INLINE UA_StatusCode
1249 UA_CallMethodResult_decodeBinary(const UA_ByteString *src, size_t *offset, UA_CallMethodResult *dst) {
1250  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CALLMETHODRESULT]);
1251 }
1252 
1253 /* ParsingResult */
1254 static UA_INLINE UA_StatusCode
1255 UA_ParsingResult_encodeBinary(const UA_ParsingResult *src, UA_ByteString *dst, size_t *offset) {
1256  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_PARSINGRESULT], NULL, NULL, dst, offset);
1257 }
1258 static UA_INLINE UA_StatusCode
1259 UA_ParsingResult_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ParsingResult *dst) {
1260  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_PARSINGRESULT]);
1261 }
1262 
1263 /* RelativePathElement */
1264 static UA_INLINE UA_StatusCode
1265 UA_RelativePathElement_encodeBinary(const UA_RelativePathElement *src, UA_ByteString *dst, size_t *offset) {
1266  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_RELATIVEPATHELEMENT], NULL, NULL, dst, offset);
1267 }
1268 static UA_INLINE UA_StatusCode
1269 UA_RelativePathElement_decodeBinary(const UA_ByteString *src, size_t *offset, UA_RelativePathElement *dst) {
1270  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_RELATIVEPATHELEMENT]);
1271 }
1272 
1273 /* BrowseDirection */
1274 static UA_INLINE UA_StatusCode
1275 UA_BrowseDirection_encodeBinary(const UA_BrowseDirection *src, UA_ByteString *dst, size_t *offset) {
1276  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_BROWSEDIRECTION], NULL, NULL, dst, offset);
1277 }
1278 static UA_INLINE UA_StatusCode
1279 UA_BrowseDirection_decodeBinary(const UA_ByteString *src, size_t *offset, UA_BrowseDirection *dst) {
1280  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_BROWSEDIRECTION]);
1281 }
1282 
1283 /* CallMethodRequest */
1284 static UA_INLINE UA_StatusCode
1285 UA_CallMethodRequest_encodeBinary(const UA_CallMethodRequest *src, UA_ByteString *dst, size_t *offset) {
1286  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_CALLMETHODREQUEST], NULL, NULL, dst, offset);
1287 }
1288 static UA_INLINE UA_StatusCode
1289 UA_CallMethodRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_CallMethodRequest *dst) {
1290  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CALLMETHODREQUEST]);
1291 }
1292 
1293 /* UnregisterNodesRequest */
1294 static UA_INLINE UA_StatusCode
1295 UA_UnregisterNodesRequest_encodeBinary(const UA_UnregisterNodesRequest *src, UA_ByteString *dst, size_t *offset) {
1296  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_UNREGISTERNODESREQUEST], NULL, NULL, dst, offset);
1297 }
1298 static UA_INLINE UA_StatusCode
1299 UA_UnregisterNodesRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_UnregisterNodesRequest *dst) {
1300  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_UNREGISTERNODESREQUEST]);
1301 }
1302 
1303 /* ContentFilterElementResult */
1304 static UA_INLINE UA_StatusCode
1305 UA_ContentFilterElementResult_encodeBinary(const UA_ContentFilterElementResult *src, UA_ByteString *dst, size_t *offset) {
1307 }
1308 static UA_INLINE UA_StatusCode
1309 UA_ContentFilterElementResult_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ContentFilterElementResult *dst) {
1310  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CONTENTFILTERELEMENTRESULT]);
1311 }
1312 
1313 /* QueryDataSet */
1314 static UA_INLINE UA_StatusCode
1315 UA_QueryDataSet_encodeBinary(const UA_QueryDataSet *src, UA_ByteString *dst, size_t *offset) {
1316  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_QUERYDATASET], NULL, NULL, dst, offset);
1317 }
1318 static UA_INLINE UA_StatusCode
1319 UA_QueryDataSet_decodeBinary(const UA_ByteString *src, size_t *offset, UA_QueryDataSet *dst) {
1320  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_QUERYDATASET]);
1321 }
1322 
1323 /* AnonymousIdentityToken */
1324 static UA_INLINE UA_StatusCode
1325 UA_AnonymousIdentityToken_encodeBinary(const UA_AnonymousIdentityToken *src, UA_ByteString *dst, size_t *offset) {
1326  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_ANONYMOUSIDENTITYTOKEN], NULL, NULL, dst, offset);
1327 }
1328 static UA_INLINE UA_StatusCode
1329 UA_AnonymousIdentityToken_decodeBinary(const UA_ByteString *src, size_t *offset, UA_AnonymousIdentityToken *dst) {
1330  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_ANONYMOUSIDENTITYTOKEN]);
1331 }
1332 
1333 /* SetPublishingModeRequest */
1334 static UA_INLINE UA_StatusCode
1335 UA_SetPublishingModeRequest_encodeBinary(const UA_SetPublishingModeRequest *src, UA_ByteString *dst, size_t *offset) {
1336  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_SETPUBLISHINGMODEREQUEST], NULL, NULL, dst, offset);
1337 }
1338 static UA_INLINE UA_StatusCode
1339 UA_SetPublishingModeRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_SetPublishingModeRequest *dst) {
1340  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_SETPUBLISHINGMODEREQUEST]);
1341 }
1342 
1343 /* TimestampsToReturn */
1344 static UA_INLINE UA_StatusCode
1345 UA_TimestampsToReturn_encodeBinary(const UA_TimestampsToReturn *src, UA_ByteString *dst, size_t *offset) {
1346  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_TIMESTAMPSTORETURN], NULL, NULL, dst, offset);
1347 }
1348 static UA_INLINE UA_StatusCode
1349 UA_TimestampsToReturn_decodeBinary(const UA_ByteString *src, size_t *offset, UA_TimestampsToReturn *dst) {
1350  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_TIMESTAMPSTORETURN]);
1351 }
1352 
1353 /* CallRequest */
1354 static UA_INLINE UA_StatusCode
1355 UA_CallRequest_encodeBinary(const UA_CallRequest *src, UA_ByteString *dst, size_t *offset) {
1356  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_CALLREQUEST], NULL, NULL, dst, offset);
1357 }
1358 static UA_INLINE UA_StatusCode
1359 UA_CallRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_CallRequest *dst) {
1360  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CALLREQUEST]);
1361 }
1362 
1363 /* MethodAttributes */
1364 static UA_INLINE UA_StatusCode
1365 UA_MethodAttributes_encodeBinary(const UA_MethodAttributes *src, UA_ByteString *dst, size_t *offset) {
1366  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_METHODATTRIBUTES], NULL, NULL, dst, offset);
1367 }
1368 static UA_INLINE UA_StatusCode
1369 UA_MethodAttributes_decodeBinary(const UA_ByteString *src, size_t *offset, UA_MethodAttributes *dst) {
1370  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_METHODATTRIBUTES]);
1371 }
1372 
1373 /* DeleteReferencesItem */
1374 static UA_INLINE UA_StatusCode
1375 UA_DeleteReferencesItem_encodeBinary(const UA_DeleteReferencesItem *src, UA_ByteString *dst, size_t *offset) {
1376  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DELETEREFERENCESITEM], NULL, NULL, dst, offset);
1377 }
1378 static UA_INLINE UA_StatusCode
1379 UA_DeleteReferencesItem_decodeBinary(const UA_ByteString *src, size_t *offset, UA_DeleteReferencesItem *dst) {
1380  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DELETEREFERENCESITEM]);
1381 }
1382 
1383 /* WriteValue */
1384 static UA_INLINE UA_StatusCode
1385 UA_WriteValue_encodeBinary(const UA_WriteValue *src, UA_ByteString *dst, size_t *offset) {
1386  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_WRITEVALUE], NULL, NULL, dst, offset);
1387 }
1388 static UA_INLINE UA_StatusCode
1389 UA_WriteValue_decodeBinary(const UA_ByteString *src, size_t *offset, UA_WriteValue *dst) {
1390  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_WRITEVALUE]);
1391 }
1392 
1393 /* MonitoredItemCreateResult */
1394 static UA_INLINE UA_StatusCode
1395 UA_MonitoredItemCreateResult_encodeBinary(const UA_MonitoredItemCreateResult *src, UA_ByteString *dst, size_t *offset) {
1397 }
1398 static UA_INLINE UA_StatusCode
1399 UA_MonitoredItemCreateResult_decodeBinary(const UA_ByteString *src, size_t *offset, UA_MonitoredItemCreateResult *dst) {
1400  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_MONITOREDITEMCREATERESULT]);
1401 }
1402 
1403 /* MessageSecurityMode */
1404 static UA_INLINE UA_StatusCode
1405 UA_MessageSecurityMode_encodeBinary(const UA_MessageSecurityMode *src, UA_ByteString *dst, size_t *offset) {
1406  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_MESSAGESECURITYMODE], NULL, NULL, dst, offset);
1407 }
1408 static UA_INLINE UA_StatusCode
1409 UA_MessageSecurityMode_decodeBinary(const UA_ByteString *src, size_t *offset, UA_MessageSecurityMode *dst) {
1410  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_MESSAGESECURITYMODE]);
1411 }
1412 
1413 /* MonitoringParameters */
1414 static UA_INLINE UA_StatusCode
1415 UA_MonitoringParameters_encodeBinary(const UA_MonitoringParameters *src, UA_ByteString *dst, size_t *offset) {
1416  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_MONITORINGPARAMETERS], NULL, NULL, dst, offset);
1417 }
1418 static UA_INLINE UA_StatusCode
1419 UA_MonitoringParameters_decodeBinary(const UA_ByteString *src, size_t *offset, UA_MonitoringParameters *dst) {
1420  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_MONITORINGPARAMETERS]);
1421 }
1422 
1423 /* SignatureData */
1424 static UA_INLINE UA_StatusCode
1425 UA_SignatureData_encodeBinary(const UA_SignatureData *src, UA_ByteString *dst, size_t *offset) {
1426  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_SIGNATUREDATA], NULL, NULL, dst, offset);
1427 }
1428 static UA_INLINE UA_StatusCode
1429 UA_SignatureData_decodeBinary(const UA_ByteString *src, size_t *offset, UA_SignatureData *dst) {
1430  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_SIGNATUREDATA]);
1431 }
1432 
1433 /* ReferenceNode */
1434 static UA_INLINE UA_StatusCode
1435 UA_ReferenceNode_encodeBinary(const UA_ReferenceNode *src, UA_ByteString *dst, size_t *offset) {
1436  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_REFERENCENODE], NULL, NULL, dst, offset);
1437 }
1438 static UA_INLINE UA_StatusCode
1439 UA_ReferenceNode_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ReferenceNode *dst) {
1440  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_REFERENCENODE]);
1441 }
1442 
1443 /* Argument */
1444 static UA_INLINE UA_StatusCode
1445 UA_Argument_encodeBinary(const UA_Argument *src, UA_ByteString *dst, size_t *offset) {
1446  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_ARGUMENT], NULL, NULL, dst, offset);
1447 }
1448 static UA_INLINE UA_StatusCode
1449 UA_Argument_decodeBinary(const UA_ByteString *src, size_t *offset, UA_Argument *dst) {
1450  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_ARGUMENT]);
1451 }
1452 
1453 /* UserIdentityToken */
1454 static UA_INLINE UA_StatusCode
1455 UA_UserIdentityToken_encodeBinary(const UA_UserIdentityToken *src, UA_ByteString *dst, size_t *offset) {
1456  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_USERIDENTITYTOKEN], NULL, NULL, dst, offset);
1457 }
1458 static UA_INLINE UA_StatusCode
1459 UA_UserIdentityToken_decodeBinary(const UA_ByteString *src, size_t *offset, UA_UserIdentityToken *dst) {
1460  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_USERIDENTITYTOKEN]);
1461 }
1462 
1463 /* ObjectTypeAttributes */
1464 static UA_INLINE UA_StatusCode
1465 UA_ObjectTypeAttributes_encodeBinary(const UA_ObjectTypeAttributes *src, UA_ByteString *dst, size_t *offset) {
1466  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_OBJECTTYPEATTRIBUTES], NULL, NULL, dst, offset);
1467 }
1468 static UA_INLINE UA_StatusCode
1469 UA_ObjectTypeAttributes_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ObjectTypeAttributes *dst) {
1470  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_OBJECTTYPEATTRIBUTES]);
1471 }
1472 
1473 /* DeadbandType */
1474 static UA_INLINE UA_StatusCode
1475 UA_DeadbandType_encodeBinary(const UA_DeadbandType *src, UA_ByteString *dst, size_t *offset) {
1476  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DEADBANDTYPE], NULL, NULL, dst, offset);
1477 }
1478 static UA_INLINE UA_StatusCode
1479 UA_DeadbandType_decodeBinary(const UA_ByteString *src, size_t *offset, UA_DeadbandType *dst) {
1480  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DEADBANDTYPE]);
1481 }
1482 
1483 /* SecurityTokenRequestType */
1484 static UA_INLINE UA_StatusCode
1485 UA_SecurityTokenRequestType_encodeBinary(const UA_SecurityTokenRequestType *src, UA_ByteString *dst, size_t *offset) {
1486  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_SECURITYTOKENREQUESTTYPE], NULL, NULL, dst, offset);
1487 }
1488 static UA_INLINE UA_StatusCode
1489 UA_SecurityTokenRequestType_decodeBinary(const UA_ByteString *src, size_t *offset, UA_SecurityTokenRequestType *dst) {
1490  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_SECURITYTOKENREQUESTTYPE]);
1491 }
1492 
1493 /* DataChangeTrigger */
1494 static UA_INLINE UA_StatusCode
1495 UA_DataChangeTrigger_encodeBinary(const UA_DataChangeTrigger *src, UA_ByteString *dst, size_t *offset) {
1496  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DATACHANGETRIGGER], NULL, NULL, dst, offset);
1497 }
1498 static UA_INLINE UA_StatusCode
1499 UA_DataChangeTrigger_decodeBinary(const UA_ByteString *src, size_t *offset, UA_DataChangeTrigger *dst) {
1500  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DATACHANGETRIGGER]);
1501 }
1502 
1503 /* BuildInfo */
1504 static UA_INLINE UA_StatusCode
1505 UA_BuildInfo_encodeBinary(const UA_BuildInfo *src, UA_ByteString *dst, size_t *offset) {
1506  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_BUILDINFO], NULL, NULL, dst, offset);
1507 }
1508 static UA_INLINE UA_StatusCode
1509 UA_BuildInfo_decodeBinary(const UA_ByteString *src, size_t *offset, UA_BuildInfo *dst) {
1510  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_BUILDINFO]);
1511 }
1512 
1513 /* NodeClass */
1514 static UA_INLINE UA_StatusCode
1515 UA_NodeClass_encodeBinary(const UA_NodeClass *src, UA_ByteString *dst, size_t *offset) {
1516  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_NODECLASS], NULL, NULL, dst, offset);
1517 }
1518 static UA_INLINE UA_StatusCode
1519 UA_NodeClass_decodeBinary(const UA_ByteString *src, size_t *offset, UA_NodeClass *dst) {
1520  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_NODECLASS]);
1521 }
1522 
1523 /* ChannelSecurityToken */
1524 static UA_INLINE UA_StatusCode
1525 UA_ChannelSecurityToken_encodeBinary(const UA_ChannelSecurityToken *src, UA_ByteString *dst, size_t *offset) {
1526  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_CHANNELSECURITYTOKEN], NULL, NULL, dst, offset);
1527 }
1528 static UA_INLINE UA_StatusCode
1529 UA_ChannelSecurityToken_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ChannelSecurityToken *dst) {
1530  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CHANNELSECURITYTOKEN]);
1531 }
1532 
1533 /* MonitoredItemNotification */
1534 static UA_INLINE UA_StatusCode
1535 UA_MonitoredItemNotification_encodeBinary(const UA_MonitoredItemNotification *src, UA_ByteString *dst, size_t *offset) {
1537 }
1538 static UA_INLINE UA_StatusCode
1539 UA_MonitoredItemNotification_decodeBinary(const UA_ByteString *src, size_t *offset, UA_MonitoredItemNotification *dst) {
1540  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_MONITOREDITEMNOTIFICATION]);
1541 }
1542 
1543 /* DeleteNodesItem */
1544 static UA_INLINE UA_StatusCode
1545 UA_DeleteNodesItem_encodeBinary(const UA_DeleteNodesItem *src, UA_ByteString *dst, size_t *offset) {
1546  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DELETENODESITEM], NULL, NULL, dst, offset);
1547 }
1548 static UA_INLINE UA_StatusCode
1549 UA_DeleteNodesItem_decodeBinary(const UA_ByteString *src, size_t *offset, UA_DeleteNodesItem *dst) {
1550  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DELETENODESITEM]);
1551 }
1552 
1553 /* SubscriptionAcknowledgement */
1554 static UA_INLINE UA_StatusCode
1555 UA_SubscriptionAcknowledgement_encodeBinary(const UA_SubscriptionAcknowledgement *src, UA_ByteString *dst, size_t *offset) {
1557 }
1558 static UA_INLINE UA_StatusCode
1559 UA_SubscriptionAcknowledgement_decodeBinary(const UA_ByteString *src, size_t *offset, UA_SubscriptionAcknowledgement *dst) {
1561 }
1562 
1563 /* ReadValueId */
1564 static UA_INLINE UA_StatusCode
1565 UA_ReadValueId_encodeBinary(const UA_ReadValueId *src, UA_ByteString *dst, size_t *offset) {
1566  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_READVALUEID], NULL, NULL, dst, offset);
1567 }
1568 static UA_INLINE UA_StatusCode
1569 UA_ReadValueId_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ReadValueId *dst) {
1570  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_READVALUEID]);
1571 }
1572 
1573 /* DataTypeAttributes */
1574 static UA_INLINE UA_StatusCode
1575 UA_DataTypeAttributes_encodeBinary(const UA_DataTypeAttributes *src, UA_ByteString *dst, size_t *offset) {
1576  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DATATYPEATTRIBUTES], NULL, NULL, dst, offset);
1577 }
1578 static UA_INLINE UA_StatusCode
1579 UA_DataTypeAttributes_decodeBinary(const UA_ByteString *src, size_t *offset, UA_DataTypeAttributes *dst) {
1580  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DATATYPEATTRIBUTES]);
1581 }
1582 
1583 /* ResponseHeader */
1584 static UA_INLINE UA_StatusCode
1585 UA_ResponseHeader_encodeBinary(const UA_ResponseHeader *src, UA_ByteString *dst, size_t *offset) {
1586  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_RESPONSEHEADER], NULL, NULL, dst, offset);
1587 }
1588 static UA_INLINE UA_StatusCode
1589 UA_ResponseHeader_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ResponseHeader *dst) {
1590  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_RESPONSEHEADER]);
1591 }
1592 
1593 /* DeleteSubscriptionsRequest */
1594 static UA_INLINE UA_StatusCode
1595 UA_DeleteSubscriptionsRequest_encodeBinary(const UA_DeleteSubscriptionsRequest *src, UA_ByteString *dst, size_t *offset) {
1597 }
1598 static UA_INLINE UA_StatusCode
1599 UA_DeleteSubscriptionsRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_DeleteSubscriptionsRequest *dst) {
1600  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DELETESUBSCRIPTIONSREQUEST]);
1601 }
1602 
1603 /* ViewDescription */
1604 static UA_INLINE UA_StatusCode
1605 UA_ViewDescription_encodeBinary(const UA_ViewDescription *src, UA_ByteString *dst, size_t *offset) {
1606  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_VIEWDESCRIPTION], NULL, NULL, dst, offset);
1607 }
1608 static UA_INLINE UA_StatusCode
1609 UA_ViewDescription_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ViewDescription *dst) {
1610  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_VIEWDESCRIPTION]);
1611 }
1612 
1613 /* DeleteMonitoredItemsResponse */
1614 static UA_INLINE UA_StatusCode
1615 UA_DeleteMonitoredItemsResponse_encodeBinary(const UA_DeleteMonitoredItemsResponse *src, UA_ByteString *dst, size_t *offset) {
1617 }
1618 static UA_INLINE UA_StatusCode
1619 UA_DeleteMonitoredItemsResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_DeleteMonitoredItemsResponse *dst) {
1621 }
1622 
1623 /* NodeAttributes */
1624 static UA_INLINE UA_StatusCode
1625 UA_NodeAttributes_encodeBinary(const UA_NodeAttributes *src, UA_ByteString *dst, size_t *offset) {
1626  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_NODEATTRIBUTES], NULL, NULL, dst, offset);
1627 }
1628 static UA_INLINE UA_StatusCode
1629 UA_NodeAttributes_decodeBinary(const UA_ByteString *src, size_t *offset, UA_NodeAttributes *dst) {
1630  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_NODEATTRIBUTES]);
1631 }
1632 
1633 /* RegisterNodesRequest */
1634 static UA_INLINE UA_StatusCode
1635 UA_RegisterNodesRequest_encodeBinary(const UA_RegisterNodesRequest *src, UA_ByteString *dst, size_t *offset) {
1636  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_REGISTERNODESREQUEST], NULL, NULL, dst, offset);
1637 }
1638 static UA_INLINE UA_StatusCode
1639 UA_RegisterNodesRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_RegisterNodesRequest *dst) {
1640  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_REGISTERNODESREQUEST]);
1641 }
1642 
1643 /* DeleteNodesRequest */
1644 static UA_INLINE UA_StatusCode
1645 UA_DeleteNodesRequest_encodeBinary(const UA_DeleteNodesRequest *src, UA_ByteString *dst, size_t *offset) {
1646  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DELETENODESREQUEST], NULL, NULL, dst, offset);
1647 }
1648 static UA_INLINE UA_StatusCode
1649 UA_DeleteNodesRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_DeleteNodesRequest *dst) {
1650  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DELETENODESREQUEST]);
1651 }
1652 
1653 /* PublishResponse */
1654 static UA_INLINE UA_StatusCode
1655 UA_PublishResponse_encodeBinary(const UA_PublishResponse *src, UA_ByteString *dst, size_t *offset) {
1656  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_PUBLISHRESPONSE], NULL, NULL, dst, offset);
1657 }
1658 static UA_INLINE UA_StatusCode
1659 UA_PublishResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_PublishResponse *dst) {
1660  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_PUBLISHRESPONSE]);
1661 }
1662 
1663 /* MonitoredItemModifyRequest */
1664 static UA_INLINE UA_StatusCode
1665 UA_MonitoredItemModifyRequest_encodeBinary(const UA_MonitoredItemModifyRequest *src, UA_ByteString *dst, size_t *offset) {
1667 }
1668 static UA_INLINE UA_StatusCode
1669 UA_MonitoredItemModifyRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_MonitoredItemModifyRequest *dst) {
1670  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_MONITOREDITEMMODIFYREQUEST]);
1671 }
1672 
1673 /* UserNameIdentityToken */
1674 static UA_INLINE UA_StatusCode
1675 UA_UserNameIdentityToken_encodeBinary(const UA_UserNameIdentityToken *src, UA_ByteString *dst, size_t *offset) {
1676  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_USERNAMEIDENTITYTOKEN], NULL, NULL, dst, offset);
1677 }
1678 static UA_INLINE UA_StatusCode
1679 UA_UserNameIdentityToken_decodeBinary(const UA_ByteString *src, size_t *offset, UA_UserNameIdentityToken *dst) {
1680  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_USERNAMEIDENTITYTOKEN]);
1681 }
1682 
1683 /* IdType */
1684 static UA_INLINE UA_StatusCode
1685 UA_IdType_encodeBinary(const UA_IdType *src, UA_ByteString *dst, size_t *offset) {
1686  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_IDTYPE], NULL, NULL, dst, offset);
1687 }
1688 static UA_INLINE UA_StatusCode
1689 UA_IdType_decodeBinary(const UA_ByteString *src, size_t *offset, UA_IdType *dst) {
1690  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_IDTYPE]);
1691 }
1692 
1693 /* UserTokenType */
1694 static UA_INLINE UA_StatusCode
1695 UA_UserTokenType_encodeBinary(const UA_UserTokenType *src, UA_ByteString *dst, size_t *offset) {
1696  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_USERTOKENTYPE], NULL, NULL, dst, offset);
1697 }
1698 static UA_INLINE UA_StatusCode
1699 UA_UserTokenType_decodeBinary(const UA_ByteString *src, size_t *offset, UA_UserTokenType *dst) {
1700  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_USERTOKENTYPE]);
1701 }
1702 
1703 /* ActivateSessionRequest */
1704 static UA_INLINE UA_StatusCode
1705 UA_ActivateSessionRequest_encodeBinary(const UA_ActivateSessionRequest *src, UA_ByteString *dst, size_t *offset) {
1706  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_ACTIVATESESSIONREQUEST], NULL, NULL, dst, offset);
1707 }
1708 static UA_INLINE UA_StatusCode
1709 UA_ActivateSessionRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ActivateSessionRequest *dst) {
1710  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_ACTIVATESESSIONREQUEST]);
1711 }
1712 
1713 /* OpenSecureChannelResponse */
1714 static UA_INLINE UA_StatusCode
1715 UA_OpenSecureChannelResponse_encodeBinary(const UA_OpenSecureChannelResponse *src, UA_ByteString *dst, size_t *offset) {
1717 }
1718 static UA_INLINE UA_StatusCode
1719 UA_OpenSecureChannelResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_OpenSecureChannelResponse *dst) {
1720  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_OPENSECURECHANNELRESPONSE]);
1721 }
1722 
1723 /* ApplicationType */
1724 static UA_INLINE UA_StatusCode
1725 UA_ApplicationType_encodeBinary(const UA_ApplicationType *src, UA_ByteString *dst, size_t *offset) {
1726  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_APPLICATIONTYPE], NULL, NULL, dst, offset);
1727 }
1728 static UA_INLINE UA_StatusCode
1729 UA_ApplicationType_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ApplicationType *dst) {
1730  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_APPLICATIONTYPE]);
1731 }
1732 
1733 /* ServerState */
1734 static UA_INLINE UA_StatusCode
1735 UA_ServerState_encodeBinary(const UA_ServerState *src, UA_ByteString *dst, size_t *offset) {
1736  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_SERVERSTATE], NULL, NULL, dst, offset);
1737 }
1738 static UA_INLINE UA_StatusCode
1739 UA_ServerState_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ServerState *dst) {
1740  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_SERVERSTATE]);
1741 }
1742 
1743 /* QueryNextResponse */
1744 static UA_INLINE UA_StatusCode
1745 UA_QueryNextResponse_encodeBinary(const UA_QueryNextResponse *src, UA_ByteString *dst, size_t *offset) {
1746  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_QUERYNEXTRESPONSE], NULL, NULL, dst, offset);
1747 }
1748 static UA_INLINE UA_StatusCode
1749 UA_QueryNextResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_QueryNextResponse *dst) {
1750  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_QUERYNEXTRESPONSE]);
1751 }
1752 
1753 /* ActivateSessionResponse */
1754 static UA_INLINE UA_StatusCode
1755 UA_ActivateSessionResponse_encodeBinary(const UA_ActivateSessionResponse *src, UA_ByteString *dst, size_t *offset) {
1756  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_ACTIVATESESSIONRESPONSE], NULL, NULL, dst, offset);
1757 }
1758 static UA_INLINE UA_StatusCode
1759 UA_ActivateSessionResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ActivateSessionResponse *dst) {
1760  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_ACTIVATESESSIONRESPONSE]);
1761 }
1762 
1763 /* FilterOperator */
1764 static UA_INLINE UA_StatusCode
1765 UA_FilterOperator_encodeBinary(const UA_FilterOperator *src, UA_ByteString *dst, size_t *offset) {
1766  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_FILTEROPERATOR], NULL, NULL, dst, offset);
1767 }
1768 static UA_INLINE UA_StatusCode
1769 UA_FilterOperator_decodeBinary(const UA_ByteString *src, size_t *offset, UA_FilterOperator *dst) {
1770  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_FILTEROPERATOR]);
1771 }
1772 
1773 /* QueryNextRequest */
1774 static UA_INLINE UA_StatusCode
1775 UA_QueryNextRequest_encodeBinary(const UA_QueryNextRequest *src, UA_ByteString *dst, size_t *offset) {
1776  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_QUERYNEXTREQUEST], NULL, NULL, dst, offset);
1777 }
1778 static UA_INLINE UA_StatusCode
1779 UA_QueryNextRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_QueryNextRequest *dst) {
1780  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_QUERYNEXTREQUEST]);
1781 }
1782 
1783 /* WriteResponse */
1784 static UA_INLINE UA_StatusCode
1785 UA_WriteResponse_encodeBinary(const UA_WriteResponse *src, UA_ByteString *dst, size_t *offset) {
1786  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_WRITERESPONSE], NULL, NULL, dst, offset);
1787 }
1788 static UA_INLINE UA_StatusCode
1789 UA_WriteResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_WriteResponse *dst) {
1790  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_WRITERESPONSE]);
1791 }
1792 
1793 /* BrowseNextRequest */
1794 static UA_INLINE UA_StatusCode
1795 UA_BrowseNextRequest_encodeBinary(const UA_BrowseNextRequest *src, UA_ByteString *dst, size_t *offset) {
1796  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_BROWSENEXTREQUEST], NULL, NULL, dst, offset);
1797 }
1798 static UA_INLINE UA_StatusCode
1799 UA_BrowseNextRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_BrowseNextRequest *dst) {
1800  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_BROWSENEXTREQUEST]);
1801 }
1802 
1803 /* CreateSubscriptionRequest */
1804 static UA_INLINE UA_StatusCode
1805 UA_CreateSubscriptionRequest_encodeBinary(const UA_CreateSubscriptionRequest *src, UA_ByteString *dst, size_t *offset) {
1807 }
1808 static UA_INLINE UA_StatusCode
1809 UA_CreateSubscriptionRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_CreateSubscriptionRequest *dst) {
1810  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CREATESUBSCRIPTIONREQUEST]);
1811 }
1812 
1813 /* VariableTypeAttributes */
1814 static UA_INLINE UA_StatusCode
1815 UA_VariableTypeAttributes_encodeBinary(const UA_VariableTypeAttributes *src, UA_ByteString *dst, size_t *offset) {
1816  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_VARIABLETYPEATTRIBUTES], NULL, NULL, dst, offset);
1817 }
1818 static UA_INLINE UA_StatusCode
1819 UA_VariableTypeAttributes_decodeBinary(const UA_ByteString *src, size_t *offset, UA_VariableTypeAttributes *dst) {
1820  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_VARIABLETYPEATTRIBUTES]);
1821 }
1822 
1823 /* BrowsePathResult */
1824 static UA_INLINE UA_StatusCode
1825 UA_BrowsePathResult_encodeBinary(const UA_BrowsePathResult *src, UA_ByteString *dst, size_t *offset) {
1826  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_BROWSEPATHRESULT], NULL, NULL, dst, offset);
1827 }
1828 static UA_INLINE UA_StatusCode
1829 UA_BrowsePathResult_decodeBinary(const UA_ByteString *src, size_t *offset, UA_BrowsePathResult *dst) {
1830  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_BROWSEPATHRESULT]);
1831 }
1832 
1833 /* ModifySubscriptionResponse */
1834 static UA_INLINE UA_StatusCode
1835 UA_ModifySubscriptionResponse_encodeBinary(const UA_ModifySubscriptionResponse *src, UA_ByteString *dst, size_t *offset) {
1837 }
1838 static UA_INLINE UA_StatusCode
1839 UA_ModifySubscriptionResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ModifySubscriptionResponse *dst) {
1840  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_MODIFYSUBSCRIPTIONRESPONSE]);
1841 }
1842 
1843 /* OpenSecureChannelRequest */
1844 static UA_INLINE UA_StatusCode
1845 UA_OpenSecureChannelRequest_encodeBinary(const UA_OpenSecureChannelRequest *src, UA_ByteString *dst, size_t *offset) {
1846  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_OPENSECURECHANNELREQUEST], NULL, NULL, dst, offset);
1847 }
1848 static UA_INLINE UA_StatusCode
1849 UA_OpenSecureChannelRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_OpenSecureChannelRequest *dst) {
1850  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_OPENSECURECHANNELREQUEST]);
1851 }
1852 
1853 /* RegisterNodesResponse */
1854 static UA_INLINE UA_StatusCode
1855 UA_RegisterNodesResponse_encodeBinary(const UA_RegisterNodesResponse *src, UA_ByteString *dst, size_t *offset) {
1856  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_REGISTERNODESRESPONSE], NULL, NULL, dst, offset);
1857 }
1858 static UA_INLINE UA_StatusCode
1859 UA_RegisterNodesResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_RegisterNodesResponse *dst) {
1860  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_REGISTERNODESRESPONSE]);
1861 }
1862 
1863 /* CloseSessionRequest */
1864 static UA_INLINE UA_StatusCode
1865 UA_CloseSessionRequest_encodeBinary(const UA_CloseSessionRequest *src, UA_ByteString *dst, size_t *offset) {
1866  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_CLOSESESSIONREQUEST], NULL, NULL, dst, offset);
1867 }
1868 static UA_INLINE UA_StatusCode
1869 UA_CloseSessionRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_CloseSessionRequest *dst) {
1870  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CLOSESESSIONREQUEST]);
1871 }
1872 
1873 /* ModifySubscriptionRequest */
1874 static UA_INLINE UA_StatusCode
1875 UA_ModifySubscriptionRequest_encodeBinary(const UA_ModifySubscriptionRequest *src, UA_ByteString *dst, size_t *offset) {
1877 }
1878 static UA_INLINE UA_StatusCode
1879 UA_ModifySubscriptionRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ModifySubscriptionRequest *dst) {
1880  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_MODIFYSUBSCRIPTIONREQUEST]);
1881 }
1882 
1883 /* UserTokenPolicy */
1884 static UA_INLINE UA_StatusCode
1885 UA_UserTokenPolicy_encodeBinary(const UA_UserTokenPolicy *src, UA_ByteString *dst, size_t *offset) {
1886  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_USERTOKENPOLICY], NULL, NULL, dst, offset);
1887 }
1888 static UA_INLINE UA_StatusCode
1889 UA_UserTokenPolicy_decodeBinary(const UA_ByteString *src, size_t *offset, UA_UserTokenPolicy *dst) {
1890  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_USERTOKENPOLICY]);
1891 }
1892 
1893 /* DeleteMonitoredItemsRequest */
1894 static UA_INLINE UA_StatusCode
1895 UA_DeleteMonitoredItemsRequest_encodeBinary(const UA_DeleteMonitoredItemsRequest *src, UA_ByteString *dst, size_t *offset) {
1897 }
1898 static UA_INLINE UA_StatusCode
1899 UA_DeleteMonitoredItemsRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_DeleteMonitoredItemsRequest *dst) {
1901 }
1902 
1903 /* ReferenceTypeAttributes */
1904 static UA_INLINE UA_StatusCode
1905 UA_ReferenceTypeAttributes_encodeBinary(const UA_ReferenceTypeAttributes *src, UA_ByteString *dst, size_t *offset) {
1906  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_REFERENCETYPEATTRIBUTES], NULL, NULL, dst, offset);
1907 }
1908 static UA_INLINE UA_StatusCode
1909 UA_ReferenceTypeAttributes_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ReferenceTypeAttributes *dst) {
1910  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_REFERENCETYPEATTRIBUTES]);
1911 }
1912 
1913 /* SetMonitoringModeRequest */
1914 static UA_INLINE UA_StatusCode
1915 UA_SetMonitoringModeRequest_encodeBinary(const UA_SetMonitoringModeRequest *src, UA_ByteString *dst, size_t *offset) {
1916  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_SETMONITORINGMODEREQUEST], NULL, NULL, dst, offset);
1917 }
1918 static UA_INLINE UA_StatusCode
1919 UA_SetMonitoringModeRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_SetMonitoringModeRequest *dst) {
1920  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_SETMONITORINGMODEREQUEST]);
1921 }
1922 
1923 /* UnregisterNodesResponse */
1924 static UA_INLINE UA_StatusCode
1925 UA_UnregisterNodesResponse_encodeBinary(const UA_UnregisterNodesResponse *src, UA_ByteString *dst, size_t *offset) {
1926  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_UNREGISTERNODESRESPONSE], NULL, NULL, dst, offset);
1927 }
1928 static UA_INLINE UA_StatusCode
1929 UA_UnregisterNodesResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_UnregisterNodesResponse *dst) {
1930  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_UNREGISTERNODESRESPONSE]);
1931 }
1932 
1933 /* WriteRequest */
1934 static UA_INLINE UA_StatusCode
1935 UA_WriteRequest_encodeBinary(const UA_WriteRequest *src, UA_ByteString *dst, size_t *offset) {
1936  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_WRITEREQUEST], NULL, NULL, dst, offset);
1937 }
1938 static UA_INLINE UA_StatusCode
1939 UA_WriteRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_WriteRequest *dst) {
1940  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_WRITEREQUEST]);
1941 }
1942 
1943 /* ObjectAttributes */
1944 static UA_INLINE UA_StatusCode
1945 UA_ObjectAttributes_encodeBinary(const UA_ObjectAttributes *src, UA_ByteString *dst, size_t *offset) {
1946  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_OBJECTATTRIBUTES], NULL, NULL, dst, offset);
1947 }
1948 static UA_INLINE UA_StatusCode
1949 UA_ObjectAttributes_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ObjectAttributes *dst) {
1950  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_OBJECTATTRIBUTES]);
1951 }
1952 
1953 /* BrowseDescription */
1954 static UA_INLINE UA_StatusCode
1955 UA_BrowseDescription_encodeBinary(const UA_BrowseDescription *src, UA_ByteString *dst, size_t *offset) {
1956  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_BROWSEDESCRIPTION], NULL, NULL, dst, offset);
1957 }
1958 static UA_INLINE UA_StatusCode
1959 UA_BrowseDescription_decodeBinary(const UA_ByteString *src, size_t *offset, UA_BrowseDescription *dst) {
1960  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_BROWSEDESCRIPTION]);
1961 }
1962 
1963 /* RepublishRequest */
1964 static UA_INLINE UA_StatusCode
1965 UA_RepublishRequest_encodeBinary(const UA_RepublishRequest *src, UA_ByteString *dst, size_t *offset) {
1966  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_REPUBLISHREQUEST], NULL, NULL, dst, offset);
1967 }
1968 static UA_INLINE UA_StatusCode
1969 UA_RepublishRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_RepublishRequest *dst) {
1970  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_REPUBLISHREQUEST]);
1971 }
1972 
1973 /* GetEndpointsRequest */
1974 static UA_INLINE UA_StatusCode
1975 UA_GetEndpointsRequest_encodeBinary(const UA_GetEndpointsRequest *src, UA_ByteString *dst, size_t *offset) {
1976  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_GETENDPOINTSREQUEST], NULL, NULL, dst, offset);
1977 }
1978 static UA_INLINE UA_StatusCode
1979 UA_GetEndpointsRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_GetEndpointsRequest *dst) {
1980  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_GETENDPOINTSREQUEST]);
1981 }
1982 
1983 /* PublishRequest */
1984 static UA_INLINE UA_StatusCode
1985 UA_PublishRequest_encodeBinary(const UA_PublishRequest *src, UA_ByteString *dst, size_t *offset) {
1986  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_PUBLISHREQUEST], NULL, NULL, dst, offset);
1987 }
1988 static UA_INLINE UA_StatusCode
1989 UA_PublishRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_PublishRequest *dst) {
1990  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_PUBLISHREQUEST]);
1991 }
1992 
1993 /* AddNodesResponse */
1994 static UA_INLINE UA_StatusCode
1995 UA_AddNodesResponse_encodeBinary(const UA_AddNodesResponse *src, UA_ByteString *dst, size_t *offset) {
1996  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_ADDNODESRESPONSE], NULL, NULL, dst, offset);
1997 }
1998 static UA_INLINE UA_StatusCode
1999 UA_AddNodesResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_AddNodesResponse *dst) {
2000  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_ADDNODESRESPONSE]);
2001 }
2002 
2003 /* DataChangeNotification */
2004 static UA_INLINE UA_StatusCode
2005 UA_DataChangeNotification_encodeBinary(const UA_DataChangeNotification *src, UA_ByteString *dst, size_t *offset) {
2006  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DATACHANGENOTIFICATION], NULL, NULL, dst, offset);
2007 }
2008 static UA_INLINE UA_StatusCode
2009 UA_DataChangeNotification_decodeBinary(const UA_ByteString *src, size_t *offset, UA_DataChangeNotification *dst) {
2010  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DATACHANGENOTIFICATION]);
2011 }
2012 
2013 /* CloseSecureChannelResponse */
2014 static UA_INLINE UA_StatusCode
2015 UA_CloseSecureChannelResponse_encodeBinary(const UA_CloseSecureChannelResponse *src, UA_ByteString *dst, size_t *offset) {
2017 }
2018 static UA_INLINE UA_StatusCode
2019 UA_CloseSecureChannelResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_CloseSecureChannelResponse *dst) {
2020  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CLOSESECURECHANNELRESPONSE]);
2021 }
2022 
2023 /* ModifyMonitoredItemsRequest */
2024 static UA_INLINE UA_StatusCode
2025 UA_ModifyMonitoredItemsRequest_encodeBinary(const UA_ModifyMonitoredItemsRequest *src, UA_ByteString *dst, size_t *offset) {
2027 }
2028 static UA_INLINE UA_StatusCode
2029 UA_ModifyMonitoredItemsRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ModifyMonitoredItemsRequest *dst) {
2031 }
2032 
2033 /* SetMonitoringModeResponse */
2034 static UA_INLINE UA_StatusCode
2035 UA_SetMonitoringModeResponse_encodeBinary(const UA_SetMonitoringModeResponse *src, UA_ByteString *dst, size_t *offset) {
2037 }
2038 static UA_INLINE UA_StatusCode
2039 UA_SetMonitoringModeResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_SetMonitoringModeResponse *dst) {
2040  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_SETMONITORINGMODERESPONSE]);
2041 }
2042 
2043 /* FindServersRequest */
2044 static UA_INLINE UA_StatusCode
2045 UA_FindServersRequest_encodeBinary(const UA_FindServersRequest *src, UA_ByteString *dst, size_t *offset) {
2046  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_FINDSERVERSREQUEST], NULL, NULL, dst, offset);
2047 }
2048 static UA_INLINE UA_StatusCode
2049 UA_FindServersRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_FindServersRequest *dst) {
2050  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_FINDSERVERSREQUEST]);
2051 }
2052 
2053 /* ReferenceDescription */
2054 static UA_INLINE UA_StatusCode
2055 UA_ReferenceDescription_encodeBinary(const UA_ReferenceDescription *src, UA_ByteString *dst, size_t *offset) {
2056  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_REFERENCEDESCRIPTION], NULL, NULL, dst, offset);
2057 }
2058 static UA_INLINE UA_StatusCode
2059 UA_ReferenceDescription_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ReferenceDescription *dst) {
2060  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_REFERENCEDESCRIPTION]);
2061 }
2062 
2063 /* SetPublishingModeResponse */
2064 static UA_INLINE UA_StatusCode
2065 UA_SetPublishingModeResponse_encodeBinary(const UA_SetPublishingModeResponse *src, UA_ByteString *dst, size_t *offset) {
2067 }
2068 static UA_INLINE UA_StatusCode
2069 UA_SetPublishingModeResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_SetPublishingModeResponse *dst) {
2070  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_SETPUBLISHINGMODERESPONSE]);
2071 }
2072 
2073 /* ContentFilterResult */
2074 static UA_INLINE UA_StatusCode
2075 UA_ContentFilterResult_encodeBinary(const UA_ContentFilterResult *src, UA_ByteString *dst, size_t *offset) {
2076  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_CONTENTFILTERRESULT], NULL, NULL, dst, offset);
2077 }
2078 static UA_INLINE UA_StatusCode
2079 UA_ContentFilterResult_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ContentFilterResult *dst) {
2080  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CONTENTFILTERRESULT]);
2081 }
2082 
2083 /* AddReferencesItem */
2084 static UA_INLINE UA_StatusCode
2085 UA_AddReferencesItem_encodeBinary(const UA_AddReferencesItem *src, UA_ByteString *dst, size_t *offset) {
2086  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_ADDREFERENCESITEM], NULL, NULL, dst, offset);
2087 }
2088 static UA_INLINE UA_StatusCode
2089 UA_AddReferencesItem_decodeBinary(const UA_ByteString *src, size_t *offset, UA_AddReferencesItem *dst) {
2090  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_ADDREFERENCESITEM]);
2091 }
2092 
2093 /* CreateSubscriptionResponse */
2094 static UA_INLINE UA_StatusCode
2095 UA_CreateSubscriptionResponse_encodeBinary(const UA_CreateSubscriptionResponse *src, UA_ByteString *dst, size_t *offset) {
2097 }
2098 static UA_INLINE UA_StatusCode
2099 UA_CreateSubscriptionResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_CreateSubscriptionResponse *dst) {
2100  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CREATESUBSCRIPTIONRESPONSE]);
2101 }
2102 
2103 /* DeleteSubscriptionsResponse */
2104 static UA_INLINE UA_StatusCode
2105 UA_DeleteSubscriptionsResponse_encodeBinary(const UA_DeleteSubscriptionsResponse *src, UA_ByteString *dst, size_t *offset) {
2107 }
2108 static UA_INLINE UA_StatusCode
2109 UA_DeleteSubscriptionsResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_DeleteSubscriptionsResponse *dst) {
2111 }
2112 
2113 /* RelativePath */
2114 static UA_INLINE UA_StatusCode
2115 UA_RelativePath_encodeBinary(const UA_RelativePath *src, UA_ByteString *dst, size_t *offset) {
2116  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_RELATIVEPATH], NULL, NULL, dst, offset);
2117 }
2118 static UA_INLINE UA_StatusCode
2119 UA_RelativePath_decodeBinary(const UA_ByteString *src, size_t *offset, UA_RelativePath *dst) {
2120  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_RELATIVEPATH]);
2121 }
2122 
2123 /* DeleteReferencesResponse */
2124 static UA_INLINE UA_StatusCode
2125 UA_DeleteReferencesResponse_encodeBinary(const UA_DeleteReferencesResponse *src, UA_ByteString *dst, size_t *offset) {
2126  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DELETEREFERENCESRESPONSE], NULL, NULL, dst, offset);
2127 }
2128 static UA_INLINE UA_StatusCode
2129 UA_DeleteReferencesResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_DeleteReferencesResponse *dst) {
2130  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DELETEREFERENCESRESPONSE]);
2131 }
2132 
2133 /* CreateMonitoredItemsResponse */
2134 static UA_INLINE UA_StatusCode
2135 UA_CreateMonitoredItemsResponse_encodeBinary(const UA_CreateMonitoredItemsResponse *src, UA_ByteString *dst, size_t *offset) {
2137 }
2138 static UA_INLINE UA_StatusCode
2139 UA_CreateMonitoredItemsResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_CreateMonitoredItemsResponse *dst) {
2141 }
2142 
2143 /* CallResponse */
2144 static UA_INLINE UA_StatusCode
2145 UA_CallResponse_encodeBinary(const UA_CallResponse *src, UA_ByteString *dst, size_t *offset) {
2146  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_CALLRESPONSE], NULL, NULL, dst, offset);
2147 }
2148 static UA_INLINE UA_StatusCode
2149 UA_CallResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_CallResponse *dst) {
2150  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CALLRESPONSE]);
2151 }
2152 
2153 /* DeleteNodesResponse */
2154 static UA_INLINE UA_StatusCode
2155 UA_DeleteNodesResponse_encodeBinary(const UA_DeleteNodesResponse *src, UA_ByteString *dst, size_t *offset) {
2156  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DELETENODESRESPONSE], NULL, NULL, dst, offset);
2157 }
2158 static UA_INLINE UA_StatusCode
2159 UA_DeleteNodesResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_DeleteNodesResponse *dst) {
2160  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DELETENODESRESPONSE]);
2161 }
2162 
2163 /* RepublishResponse */
2164 static UA_INLINE UA_StatusCode
2165 UA_RepublishResponse_encodeBinary(const UA_RepublishResponse *src, UA_ByteString *dst, size_t *offset) {
2166  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_REPUBLISHRESPONSE], NULL, NULL, dst, offset);
2167 }
2168 static UA_INLINE UA_StatusCode
2169 UA_RepublishResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_RepublishResponse *dst) {
2170  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_REPUBLISHRESPONSE]);
2171 }
2172 
2173 /* MonitoredItemCreateRequest */
2174 static UA_INLINE UA_StatusCode
2175 UA_MonitoredItemCreateRequest_encodeBinary(const UA_MonitoredItemCreateRequest *src, UA_ByteString *dst, size_t *offset) {
2177 }
2178 static UA_INLINE UA_StatusCode
2179 UA_MonitoredItemCreateRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_MonitoredItemCreateRequest *dst) {
2180  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_MONITOREDITEMCREATEREQUEST]);
2181 }
2182 
2183 /* DeleteReferencesRequest */
2184 static UA_INLINE UA_StatusCode
2185 UA_DeleteReferencesRequest_encodeBinary(const UA_DeleteReferencesRequest *src, UA_ByteString *dst, size_t *offset) {
2186  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DELETEREFERENCESREQUEST], NULL, NULL, dst, offset);
2187 }
2188 static UA_INLINE UA_StatusCode
2189 UA_DeleteReferencesRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_DeleteReferencesRequest *dst) {
2190  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DELETEREFERENCESREQUEST]);
2191 }
2192 
2193 /* ModifyMonitoredItemsResponse */
2194 static UA_INLINE UA_StatusCode
2195 UA_ModifyMonitoredItemsResponse_encodeBinary(const UA_ModifyMonitoredItemsResponse *src, UA_ByteString *dst, size_t *offset) {
2197 }
2198 static UA_INLINE UA_StatusCode
2199 UA_ModifyMonitoredItemsResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ModifyMonitoredItemsResponse *dst) {
2201 }
2202 
2203 /* ReadResponse */
2204 static UA_INLINE UA_StatusCode
2205 UA_ReadResponse_encodeBinary(const UA_ReadResponse *src, UA_ByteString *dst, size_t *offset) {
2206  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_READRESPONSE], NULL, NULL, dst, offset);
2207 }
2208 static UA_INLINE UA_StatusCode
2209 UA_ReadResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ReadResponse *dst) {
2210  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_READRESPONSE]);
2211 }
2212 
2213 /* AddReferencesRequest */
2214 static UA_INLINE UA_StatusCode
2215 UA_AddReferencesRequest_encodeBinary(const UA_AddReferencesRequest *src, UA_ByteString *dst, size_t *offset) {
2216  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_ADDREFERENCESREQUEST], NULL, NULL, dst, offset);
2217 }
2218 static UA_INLINE UA_StatusCode
2219 UA_AddReferencesRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_AddReferencesRequest *dst) {
2220  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_ADDREFERENCESREQUEST]);
2221 }
2222 
2223 /* ReadRequest */
2224 static UA_INLINE UA_StatusCode
2225 UA_ReadRequest_encodeBinary(const UA_ReadRequest *src, UA_ByteString *dst, size_t *offset) {
2226  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_READREQUEST], NULL, NULL, dst, offset);
2227 }
2228 static UA_INLINE UA_StatusCode
2229 UA_ReadRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ReadRequest *dst) {
2230  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_READREQUEST]);
2231 }
2232 
2233 /* AddNodesItem */
2234 static UA_INLINE UA_StatusCode
2235 UA_AddNodesItem_encodeBinary(const UA_AddNodesItem *src, UA_ByteString *dst, size_t *offset) {
2236  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_ADDNODESITEM], NULL, NULL, dst, offset);
2237 }
2238 static UA_INLINE UA_StatusCode
2239 UA_AddNodesItem_decodeBinary(const UA_ByteString *src, size_t *offset, UA_AddNodesItem *dst) {
2240  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_ADDNODESITEM]);
2241 }
2242 
2243 /* ServerStatusDataType */
2244 static UA_INLINE UA_StatusCode
2245 UA_ServerStatusDataType_encodeBinary(const UA_ServerStatusDataType *src, UA_ByteString *dst, size_t *offset) {
2246  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_SERVERSTATUSDATATYPE], NULL, NULL, dst, offset);
2247 }
2248 static UA_INLINE UA_StatusCode
2249 UA_ServerStatusDataType_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ServerStatusDataType *dst) {
2250  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_SERVERSTATUSDATATYPE]);
2251 }
2252 
2253 /* AddReferencesResponse */
2254 static UA_INLINE UA_StatusCode
2255 UA_AddReferencesResponse_encodeBinary(const UA_AddReferencesResponse *src, UA_ByteString *dst, size_t *offset) {
2256  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_ADDREFERENCESRESPONSE], NULL, NULL, dst, offset);
2257 }
2258 static UA_INLINE UA_StatusCode
2259 UA_AddReferencesResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_AddReferencesResponse *dst) {
2260  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_ADDREFERENCESRESPONSE]);
2261 }
2262 
2263 /* TranslateBrowsePathsToNodeIdsResponse */
2264 static UA_INLINE UA_StatusCode
2265 UA_TranslateBrowsePathsToNodeIdsResponse_encodeBinary(const UA_TranslateBrowsePathsToNodeIdsResponse *src, UA_ByteString *dst, size_t *offset) {
2267 }
2268 static UA_INLINE UA_StatusCode
2269 UA_TranslateBrowsePathsToNodeIdsResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_TranslateBrowsePathsToNodeIdsResponse *dst) {
2271 }
2272 
2273 /* DataChangeFilter */
2274 static UA_INLINE UA_StatusCode
2275 UA_DataChangeFilter_encodeBinary(const UA_DataChangeFilter *src, UA_ByteString *dst, size_t *offset) {
2276  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DATACHANGEFILTER], NULL, NULL, dst, offset);
2277 }
2278 static UA_INLINE UA_StatusCode
2279 UA_DataChangeFilter_decodeBinary(const UA_ByteString *src, size_t *offset, UA_DataChangeFilter *dst) {
2280  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DATACHANGEFILTER]);
2281 }
2282 
2283 /* ContentFilterElement */
2284 static UA_INLINE UA_StatusCode
2285 UA_ContentFilterElement_encodeBinary(const UA_ContentFilterElement *src, UA_ByteString *dst, size_t *offset) {
2286  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_CONTENTFILTERELEMENT], NULL, NULL, dst, offset);
2287 }
2288 static UA_INLINE UA_StatusCode
2289 UA_ContentFilterElement_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ContentFilterElement *dst) {
2290  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CONTENTFILTERELEMENT]);
2291 }
2292 
2293 /* CloseSessionResponse */
2294 static UA_INLINE UA_StatusCode
2295 UA_CloseSessionResponse_encodeBinary(const UA_CloseSessionResponse *src, UA_ByteString *dst, size_t *offset) {
2296  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_CLOSESESSIONRESPONSE], NULL, NULL, dst, offset);
2297 }
2298 static UA_INLINE UA_StatusCode
2299 UA_CloseSessionResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_CloseSessionResponse *dst) {
2300  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CLOSESESSIONRESPONSE]);
2301 }
2302 
2303 /* ApplicationDescription */
2304 static UA_INLINE UA_StatusCode
2305 UA_ApplicationDescription_encodeBinary(const UA_ApplicationDescription *src, UA_ByteString *dst, size_t *offset) {
2306  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_APPLICATIONDESCRIPTION], NULL, NULL, dst, offset);
2307 }
2308 static UA_INLINE UA_StatusCode
2309 UA_ApplicationDescription_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ApplicationDescription *dst) {
2310  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_APPLICATIONDESCRIPTION]);
2311 }
2312 
2313 /* ServiceFault */
2314 static UA_INLINE UA_StatusCode
2315 UA_ServiceFault_encodeBinary(const UA_ServiceFault *src, UA_ByteString *dst, size_t *offset) {
2316  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_SERVICEFAULT], NULL, NULL, dst, offset);
2317 }
2318 static UA_INLINE UA_StatusCode
2319 UA_ServiceFault_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ServiceFault *dst) {
2320  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_SERVICEFAULT]);
2321 }
2322 
2323 /* FindServersResponse */
2324 static UA_INLINE UA_StatusCode
2325 UA_FindServersResponse_encodeBinary(const UA_FindServersResponse *src, UA_ByteString *dst, size_t *offset) {
2326  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_FINDSERVERSRESPONSE], NULL, NULL, dst, offset);
2327 }
2328 static UA_INLINE UA_StatusCode
2329 UA_FindServersResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_FindServersResponse *dst) {
2330  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_FINDSERVERSRESPONSE]);
2331 }
2332 
2333 /* CreateMonitoredItemsRequest */
2334 static UA_INLINE UA_StatusCode
2335 UA_CreateMonitoredItemsRequest_encodeBinary(const UA_CreateMonitoredItemsRequest *src, UA_ByteString *dst, size_t *offset) {
2337 }
2338 static UA_INLINE UA_StatusCode
2339 UA_CreateMonitoredItemsRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_CreateMonitoredItemsRequest *dst) {
2341 }
2342 
2343 /* ContentFilter */
2344 static UA_INLINE UA_StatusCode
2345 UA_ContentFilter_encodeBinary(const UA_ContentFilter *src, UA_ByteString *dst, size_t *offset) {
2346  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_CONTENTFILTER], NULL, NULL, dst, offset);
2347 }
2348 static UA_INLINE UA_StatusCode
2349 UA_ContentFilter_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ContentFilter *dst) {
2350  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CONTENTFILTER]);
2351 }
2352 
2353 /* QueryFirstResponse */
2354 static UA_INLINE UA_StatusCode
2355 UA_QueryFirstResponse_encodeBinary(const UA_QueryFirstResponse *src, UA_ByteString *dst, size_t *offset) {
2356  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_QUERYFIRSTRESPONSE], NULL, NULL, dst, offset);
2357 }
2358 static UA_INLINE UA_StatusCode
2359 UA_QueryFirstResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_QueryFirstResponse *dst) {
2360  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_QUERYFIRSTRESPONSE]);
2361 }
2362 
2363 /* AddNodesRequest */
2364 static UA_INLINE UA_StatusCode
2365 UA_AddNodesRequest_encodeBinary(const UA_AddNodesRequest *src, UA_ByteString *dst, size_t *offset) {
2366  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_ADDNODESREQUEST], NULL, NULL, dst, offset);
2367 }
2368 static UA_INLINE UA_StatusCode
2369 UA_AddNodesRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_AddNodesRequest *dst) {
2370  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_ADDNODESREQUEST]);
2371 }
2372 
2373 /* BrowseRequest */
2374 static UA_INLINE UA_StatusCode
2375 UA_BrowseRequest_encodeBinary(const UA_BrowseRequest *src, UA_ByteString *dst, size_t *offset) {
2376  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_BROWSEREQUEST], NULL, NULL, dst, offset);
2377 }
2378 static UA_INLINE UA_StatusCode
2379 UA_BrowseRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_BrowseRequest *dst) {
2380  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_BROWSEREQUEST]);
2381 }
2382 
2383 /* BrowsePath */
2384 static UA_INLINE UA_StatusCode
2385 UA_BrowsePath_encodeBinary(const UA_BrowsePath *src, UA_ByteString *dst, size_t *offset) {
2386  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_BROWSEPATH], NULL, NULL, dst, offset);
2387 }
2388 static UA_INLINE UA_StatusCode
2389 UA_BrowsePath_decodeBinary(const UA_ByteString *src, size_t *offset, UA_BrowsePath *dst) {
2390  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_BROWSEPATH]);
2391 }
2392 
2393 /* BrowseResult */
2394 static UA_INLINE UA_StatusCode
2395 UA_BrowseResult_encodeBinary(const UA_BrowseResult *src, UA_ByteString *dst, size_t *offset) {
2396  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_BROWSERESULT], NULL, NULL, dst, offset);
2397 }
2398 static UA_INLINE UA_StatusCode
2399 UA_BrowseResult_decodeBinary(const UA_ByteString *src, size_t *offset, UA_BrowseResult *dst) {
2400  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_BROWSERESULT]);
2401 }
2402 
2403 /* CreateSessionRequest */
2404 static UA_INLINE UA_StatusCode
2405 UA_CreateSessionRequest_encodeBinary(const UA_CreateSessionRequest *src, UA_ByteString *dst, size_t *offset) {
2406  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_CREATESESSIONREQUEST], NULL, NULL, dst, offset);
2407 }
2408 static UA_INLINE UA_StatusCode
2409 UA_CreateSessionRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_CreateSessionRequest *dst) {
2410  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CREATESESSIONREQUEST]);
2411 }
2412 
2413 /* QueryDataDescription */
2414 static UA_INLINE UA_StatusCode
2415 UA_QueryDataDescription_encodeBinary(const UA_QueryDataDescription *src, UA_ByteString *dst, size_t *offset) {
2416  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_QUERYDATADESCRIPTION], NULL, NULL, dst, offset);
2417 }
2418 static UA_INLINE UA_StatusCode
2419 UA_QueryDataDescription_decodeBinary(const UA_ByteString *src, size_t *offset, UA_QueryDataDescription *dst) {
2420  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_QUERYDATADESCRIPTION]);
2421 }
2422 
2423 /* EndpointDescription */
2424 static UA_INLINE UA_StatusCode
2425 UA_EndpointDescription_encodeBinary(const UA_EndpointDescription *src, UA_ByteString *dst, size_t *offset) {
2426  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_ENDPOINTDESCRIPTION], NULL, NULL, dst, offset);
2427 }
2428 static UA_INLINE UA_StatusCode
2429 UA_EndpointDescription_decodeBinary(const UA_ByteString *src, size_t *offset, UA_EndpointDescription *dst) {
2430  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_ENDPOINTDESCRIPTION]);
2431 }
2432 
2433 /* GetEndpointsResponse */
2434 static UA_INLINE UA_StatusCode
2435 UA_GetEndpointsResponse_encodeBinary(const UA_GetEndpointsResponse *src, UA_ByteString *dst, size_t *offset) {
2436  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_GETENDPOINTSRESPONSE], NULL, NULL, dst, offset);
2437 }
2438 static UA_INLINE UA_StatusCode
2439 UA_GetEndpointsResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_GetEndpointsResponse *dst) {
2440  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_GETENDPOINTSRESPONSE]);
2441 }
2442 
2443 /* NodeTypeDescription */
2444 static UA_INLINE UA_StatusCode
2445 UA_NodeTypeDescription_encodeBinary(const UA_NodeTypeDescription *src, UA_ByteString *dst, size_t *offset) {
2446  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_NODETYPEDESCRIPTION], NULL, NULL, dst, offset);
2447 }
2448 static UA_INLINE UA_StatusCode
2449 UA_NodeTypeDescription_decodeBinary(const UA_ByteString *src, size_t *offset, UA_NodeTypeDescription *dst) {
2450  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_NODETYPEDESCRIPTION]);
2451 }
2452 
2453 /* BrowseNextResponse */
2454 static UA_INLINE UA_StatusCode
2455 UA_BrowseNextResponse_encodeBinary(const UA_BrowseNextResponse *src, UA_ByteString *dst, size_t *offset) {
2456  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_BROWSENEXTRESPONSE], NULL, NULL, dst, offset);
2457 }
2458 static UA_INLINE UA_StatusCode
2459 UA_BrowseNextResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_BrowseNextResponse *dst) {
2460  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_BROWSENEXTRESPONSE]);
2461 }
2462 
2463 /* TranslateBrowsePathsToNodeIdsRequest */
2464 static UA_INLINE UA_StatusCode
2465 UA_TranslateBrowsePathsToNodeIdsRequest_encodeBinary(const UA_TranslateBrowsePathsToNodeIdsRequest *src, UA_ByteString *dst, size_t *offset) {
2467 }
2468 static UA_INLINE UA_StatusCode
2469 UA_TranslateBrowsePathsToNodeIdsRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_TranslateBrowsePathsToNodeIdsRequest *dst) {
2471 }
2472 
2473 /* BrowseResponse */
2474 static UA_INLINE UA_StatusCode
2475 UA_BrowseResponse_encodeBinary(const UA_BrowseResponse *src, UA_ByteString *dst, size_t *offset) {
2476  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_BROWSERESPONSE], NULL, NULL, dst, offset);
2477 }
2478 static UA_INLINE UA_StatusCode
2479 UA_BrowseResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_BrowseResponse *dst) {
2480  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_BROWSERESPONSE]);
2481 }
2482 
2483 /* CreateSessionResponse */
2484 static UA_INLINE UA_StatusCode
2485 UA_CreateSessionResponse_encodeBinary(const UA_CreateSessionResponse *src, UA_ByteString *dst, size_t *offset) {
2486  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_CREATESESSIONRESPONSE], NULL, NULL, dst, offset);
2487 }
2488 static UA_INLINE UA_StatusCode
2489 UA_CreateSessionResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_CreateSessionResponse *dst) {
2490  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CREATESESSIONRESPONSE]);
2491 }
2492 
2493 /* QueryFirstRequest */
2494 static UA_INLINE UA_StatusCode
2495 UA_QueryFirstRequest_encodeBinary(const UA_QueryFirstRequest *src, UA_ByteString *dst, size_t *offset) {
2496  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_QUERYFIRSTREQUEST], NULL, NULL, dst, offset);
2497 }
2498 static UA_INLINE UA_StatusCode
2499 UA_QueryFirstRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_QueryFirstRequest *dst) {
2500  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_QUERYFIRSTREQUEST]);
2501 }
2502 
2503 /*********************************** amalgamated original file "/home/iosb/sw/open62541/build/src_generated/ua_transport_generated.h" ***********************************/
2504 
2505 /* Generated from Opc.Ua.Types.bsd, Custom.Opc.Ua.Transport.bsd with script /home/iosb/sw/open62541/tools/generate_datatypes.py
2506  * on host iosb-VirtualBox by user iosb at 2018-11-29 10:33:06 */
2507 
2508 
2509 #ifdef __cplusplus
2510 extern "C" {
2511 #endif
2512 
2513 
2518 #define UA_TRANSPORT_COUNT 12
2520 
2525 typedef struct {
2529 
2530 #define UA_TRANSPORT_SECURECONVERSATIONMESSAGEABORTBODY 0
2531 
2536 typedef struct {
2537  size_t paddingSize;
2541 
2542 #define UA_TRANSPORT_SECURECONVERSATIONMESSAGEFOOTER 1
2543 
2548 typedef struct {
2556 
2557 #define UA_TRANSPORT_TCPHELLOMESSAGE 2
2558 
2563 typedef struct {
2567 
2568 #define UA_TRANSPORT_TCPERRORMESSAGE 3
2569 
2574 typedef enum {
2582 } UA_MessageType;
2583 UA_STATIC_ASSERT(sizeof(UA_MessageType) == sizeof(UA_Int32), enum_must_be_32bit);
2584 
2585 #define UA_TRANSPORT_MESSAGETYPE 4
2586 
2591 typedef struct {
2596 
2597 #define UA_TRANSPORT_ASYMMETRICALGORITHMSECURITYHEADER 5
2598 
2603 typedef struct {
2610 
2611 #define UA_TRANSPORT_TCPACKNOWLEDGEMESSAGE 6
2612 
2617 typedef struct {
2621 
2622 #define UA_TRANSPORT_SEQUENCEHEADER 7
2623 
2628 typedef struct {
2632 
2633 #define UA_TRANSPORT_TCPMESSAGEHEADER 8
2634 
2639 typedef enum {
2640  UA_CHUNKTYPE_FINAL = 0x46000000,
2642  UA_CHUNKTYPE_ABORT = 0x41000000,
2644 } UA_ChunkType;
2645 UA_STATIC_ASSERT(sizeof(UA_ChunkType) == sizeof(UA_Int32), enum_must_be_32bit);
2646 
2647 #define UA_TRANSPORT_CHUNKTYPE 9
2648 
2653 typedef struct {
2656 
2657 #define UA_TRANSPORT_SYMMETRICALGORITHMSECURITYHEADER 10
2658 
2663 typedef struct {
2667 
2668 #define UA_TRANSPORT_SECURECONVERSATIONMESSAGEHEADER 11
2669 
2670 #ifdef __cplusplus
2671 } // extern "C"
2672 #endif
2673 
2674 
2675 /*********************************** amalgamated original file "/home/iosb/sw/open62541/build/src_generated/ua_transport_generated_handling.h" ***********************************/
2676 
2677 /* Generated from Opc.Ua.Types.bsd, Custom.Opc.Ua.Transport.bsd with script /home/iosb/sw/open62541/tools/generate_datatypes.py
2678  * on host iosb-VirtualBox by user iosb at 2018-11-29 10:33:06 */
2679 
2680 
2681 #ifdef __cplusplus
2682 extern "C" {
2683 #endif
2684 
2685 
2686 #if defined(__GNUC__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 6
2687 # pragma GCC diagnostic push
2688 # pragma GCC diagnostic ignored "-Wmissing-field-initializers"
2689 # pragma GCC diagnostic ignored "-Wmissing-braces"
2690 #endif
2691 
2692 
2693 /* SecureConversationMessageAbortBody */
2694 static UA_INLINE void
2695 UA_SecureConversationMessageAbortBody_init(UA_SecureConversationMessageAbortBody *p) {
2696  memset(p, 0, sizeof(UA_SecureConversationMessageAbortBody));
2697 }
2698 
2700 UA_SecureConversationMessageAbortBody_new(void) {
2702 }
2703 
2704 static UA_INLINE UA_StatusCode
2705 UA_SecureConversationMessageAbortBody_copy(const UA_SecureConversationMessageAbortBody *src, UA_SecureConversationMessageAbortBody *dst) {
2706  return UA_copy(src, dst, &UA_TRANSPORT[UA_TRANSPORT_SECURECONVERSATIONMESSAGEABORTBODY]);
2707 }
2708 
2709 static UA_INLINE void
2710 UA_SecureConversationMessageAbortBody_deleteMembers(UA_SecureConversationMessageAbortBody *p) {
2712 }
2713 
2714 static UA_INLINE void
2715 UA_SecureConversationMessageAbortBody_delete(UA_SecureConversationMessageAbortBody *p) {
2717 }
2718 
2719 /* SecureConversationMessageFooter */
2720 static UA_INLINE void
2721 UA_SecureConversationMessageFooter_init(UA_SecureConversationMessageFooter *p) {
2722  memset(p, 0, sizeof(UA_SecureConversationMessageFooter));
2723 }
2724 
2726 UA_SecureConversationMessageFooter_new(void) {
2728 }
2729 
2730 static UA_INLINE UA_StatusCode
2731 UA_SecureConversationMessageFooter_copy(const UA_SecureConversationMessageFooter *src, UA_SecureConversationMessageFooter *dst) {
2732  return UA_copy(src, dst, &UA_TRANSPORT[UA_TRANSPORT_SECURECONVERSATIONMESSAGEFOOTER]);
2733 }
2734 
2735 static UA_INLINE void
2736 UA_SecureConversationMessageFooter_deleteMembers(UA_SecureConversationMessageFooter *p) {
2738 }
2739 
2740 static UA_INLINE void
2741 UA_SecureConversationMessageFooter_delete(UA_SecureConversationMessageFooter *p) {
2743 }
2744 
2745 /* TcpHelloMessage */
2746 static UA_INLINE void
2747 UA_TcpHelloMessage_init(UA_TcpHelloMessage *p) {
2748  memset(p, 0, sizeof(UA_TcpHelloMessage));
2749 }
2750 
2752 UA_TcpHelloMessage_new(void) {
2753  return (UA_TcpHelloMessage*)UA_new(&UA_TRANSPORT[UA_TRANSPORT_TCPHELLOMESSAGE]);
2754 }
2755 
2756 static UA_INLINE UA_StatusCode
2757 UA_TcpHelloMessage_copy(const UA_TcpHelloMessage *src, UA_TcpHelloMessage *dst) {
2758  return UA_copy(src, dst, &UA_TRANSPORT[UA_TRANSPORT_TCPHELLOMESSAGE]);
2759 }
2760 
2761 static UA_INLINE void
2762 UA_TcpHelloMessage_deleteMembers(UA_TcpHelloMessage *p) {
2764 }
2765 
2766 static UA_INLINE void
2767 UA_TcpHelloMessage_delete(UA_TcpHelloMessage *p) {
2768  UA_delete(p, &UA_TRANSPORT[UA_TRANSPORT_TCPHELLOMESSAGE]);
2769 }
2770 
2771 /* TcpErrorMessage */
2772 static UA_INLINE void
2773 UA_TcpErrorMessage_init(UA_TcpErrorMessage *p) {
2774  memset(p, 0, sizeof(UA_TcpErrorMessage));
2775 }
2776 
2778 UA_TcpErrorMessage_new(void) {
2779  return (UA_TcpErrorMessage*)UA_new(&UA_TRANSPORT[UA_TRANSPORT_TCPERRORMESSAGE]);
2780 }
2781 
2782 static UA_INLINE UA_StatusCode
2783 UA_TcpErrorMessage_copy(const UA_TcpErrorMessage *src, UA_TcpErrorMessage *dst) {
2784  return UA_copy(src, dst, &UA_TRANSPORT[UA_TRANSPORT_TCPERRORMESSAGE]);
2785 }
2786 
2787 static UA_INLINE void
2788 UA_TcpErrorMessage_deleteMembers(UA_TcpErrorMessage *p) {
2790 }
2791 
2792 static UA_INLINE void
2793 UA_TcpErrorMessage_delete(UA_TcpErrorMessage *p) {
2794  UA_delete(p, &UA_TRANSPORT[UA_TRANSPORT_TCPERRORMESSAGE]);
2795 }
2796 
2797 /* MessageType */
2798 static UA_INLINE void
2799 UA_MessageType_init(UA_MessageType *p) {
2800  memset(p, 0, sizeof(UA_MessageType));
2801 }
2802 
2803 static UA_INLINE UA_MessageType *
2804 UA_MessageType_new(void) {
2805  return (UA_MessageType*)UA_new(&UA_TRANSPORT[UA_TRANSPORT_MESSAGETYPE]);
2806 }
2807 
2808 static UA_INLINE UA_StatusCode
2809 UA_MessageType_copy(const UA_MessageType *src, UA_MessageType *dst) {
2810  *dst = *src;
2811  return UA_STATUSCODE_GOOD;
2812 }
2813 
2814 static UA_INLINE void
2815 UA_MessageType_deleteMembers(UA_MessageType *p) { }
2816 
2817 static UA_INLINE void
2818 UA_MessageType_delete(UA_MessageType *p) {
2819  UA_delete(p, &UA_TRANSPORT[UA_TRANSPORT_MESSAGETYPE]);
2820 }
2821 
2822 /* AsymmetricAlgorithmSecurityHeader */
2823 static UA_INLINE void
2824 UA_AsymmetricAlgorithmSecurityHeader_init(UA_AsymmetricAlgorithmSecurityHeader *p) {
2825  memset(p, 0, sizeof(UA_AsymmetricAlgorithmSecurityHeader));
2826 }
2827 
2829 UA_AsymmetricAlgorithmSecurityHeader_new(void) {
2831 }
2832 
2833 static UA_INLINE UA_StatusCode
2834 UA_AsymmetricAlgorithmSecurityHeader_copy(const UA_AsymmetricAlgorithmSecurityHeader *src, UA_AsymmetricAlgorithmSecurityHeader *dst) {
2835  return UA_copy(src, dst, &UA_TRANSPORT[UA_TRANSPORT_ASYMMETRICALGORITHMSECURITYHEADER]);
2836 }
2837 
2838 static UA_INLINE void
2839 UA_AsymmetricAlgorithmSecurityHeader_deleteMembers(UA_AsymmetricAlgorithmSecurityHeader *p) {
2841 }
2842 
2843 static UA_INLINE void
2844 UA_AsymmetricAlgorithmSecurityHeader_delete(UA_AsymmetricAlgorithmSecurityHeader *p) {
2846 }
2847 
2848 /* TcpAcknowledgeMessage */
2849 static UA_INLINE void
2850 UA_TcpAcknowledgeMessage_init(UA_TcpAcknowledgeMessage *p) {
2851  memset(p, 0, sizeof(UA_TcpAcknowledgeMessage));
2852 }
2853 
2855 UA_TcpAcknowledgeMessage_new(void) {
2857 }
2858 
2859 static UA_INLINE UA_StatusCode
2860 UA_TcpAcknowledgeMessage_copy(const UA_TcpAcknowledgeMessage *src, UA_TcpAcknowledgeMessage *dst) {
2861  *dst = *src;
2862  return UA_STATUSCODE_GOOD;
2863 }
2864 
2865 static UA_INLINE void
2866 UA_TcpAcknowledgeMessage_deleteMembers(UA_TcpAcknowledgeMessage *p) { }
2867 
2868 static UA_INLINE void
2869 UA_TcpAcknowledgeMessage_delete(UA_TcpAcknowledgeMessage *p) {
2870  UA_delete(p, &UA_TRANSPORT[UA_TRANSPORT_TCPACKNOWLEDGEMESSAGE]);
2871 }
2872 
2873 /* SequenceHeader */
2874 static UA_INLINE void
2875 UA_SequenceHeader_init(UA_SequenceHeader *p) {
2876  memset(p, 0, sizeof(UA_SequenceHeader));
2877 }
2878 
2880 UA_SequenceHeader_new(void) {
2881  return (UA_SequenceHeader*)UA_new(&UA_TRANSPORT[UA_TRANSPORT_SEQUENCEHEADER]);
2882 }
2883 
2884 static UA_INLINE UA_StatusCode
2885 UA_SequenceHeader_copy(const UA_SequenceHeader *src, UA_SequenceHeader *dst) {
2886  *dst = *src;
2887  return UA_STATUSCODE_GOOD;
2888 }
2889 
2890 static UA_INLINE void
2891 UA_SequenceHeader_deleteMembers(UA_SequenceHeader *p) { }
2892 
2893 static UA_INLINE void
2894 UA_SequenceHeader_delete(UA_SequenceHeader *p) {
2895  UA_delete(p, &UA_TRANSPORT[UA_TRANSPORT_SEQUENCEHEADER]);
2896 }
2897 
2898 /* TcpMessageHeader */
2899 static UA_INLINE void
2900 UA_TcpMessageHeader_init(UA_TcpMessageHeader *p) {
2901  memset(p, 0, sizeof(UA_TcpMessageHeader));
2902 }
2903 
2905 UA_TcpMessageHeader_new(void) {
2906  return (UA_TcpMessageHeader*)UA_new(&UA_TRANSPORT[UA_TRANSPORT_TCPMESSAGEHEADER]);
2907 }
2908 
2909 static UA_INLINE UA_StatusCode
2910 UA_TcpMessageHeader_copy(const UA_TcpMessageHeader *src, UA_TcpMessageHeader *dst) {
2911  *dst = *src;
2912  return UA_STATUSCODE_GOOD;
2913 }
2914 
2915 static UA_INLINE void
2916 UA_TcpMessageHeader_deleteMembers(UA_TcpMessageHeader *p) { }
2917 
2918 static UA_INLINE void
2919 UA_TcpMessageHeader_delete(UA_TcpMessageHeader *p) {
2920  UA_delete(p, &UA_TRANSPORT[UA_TRANSPORT_TCPMESSAGEHEADER]);
2921 }
2922 
2923 /* ChunkType */
2924 static UA_INLINE void
2925 UA_ChunkType_init(UA_ChunkType *p) {
2926  memset(p, 0, sizeof(UA_ChunkType));
2927 }
2928 
2929 static UA_INLINE UA_ChunkType *
2930 UA_ChunkType_new(void) {
2931  return (UA_ChunkType*)UA_new(&UA_TRANSPORT[UA_TRANSPORT_CHUNKTYPE]);
2932 }
2933 
2934 static UA_INLINE UA_StatusCode
2935 UA_ChunkType_copy(const UA_ChunkType *src, UA_ChunkType *dst) {
2936  *dst = *src;
2937  return UA_STATUSCODE_GOOD;
2938 }
2939 
2940 static UA_INLINE void
2941 UA_ChunkType_deleteMembers(UA_ChunkType *p) { }
2942 
2943 static UA_INLINE void
2944 UA_ChunkType_delete(UA_ChunkType *p) {
2945  UA_delete(p, &UA_TRANSPORT[UA_TRANSPORT_CHUNKTYPE]);
2946 }
2947 
2948 /* SymmetricAlgorithmSecurityHeader */
2949 static UA_INLINE void
2950 UA_SymmetricAlgorithmSecurityHeader_init(UA_SymmetricAlgorithmSecurityHeader *p) {
2951  memset(p, 0, sizeof(UA_SymmetricAlgorithmSecurityHeader));
2952 }
2953 
2955 UA_SymmetricAlgorithmSecurityHeader_new(void) {
2957 }
2958 
2959 static UA_INLINE UA_StatusCode
2960 UA_SymmetricAlgorithmSecurityHeader_copy(const UA_SymmetricAlgorithmSecurityHeader *src, UA_SymmetricAlgorithmSecurityHeader *dst) {
2961  *dst = *src;
2962  return UA_STATUSCODE_GOOD;
2963 }
2964 
2965 static UA_INLINE void
2966 UA_SymmetricAlgorithmSecurityHeader_deleteMembers(UA_SymmetricAlgorithmSecurityHeader *p) { }
2967 
2968 static UA_INLINE void
2969 UA_SymmetricAlgorithmSecurityHeader_delete(UA_SymmetricAlgorithmSecurityHeader *p) {
2971 }
2972 
2973 /* SecureConversationMessageHeader */
2974 static UA_INLINE void
2975 UA_SecureConversationMessageHeader_init(UA_SecureConversationMessageHeader *p) {
2976  memset(p, 0, sizeof(UA_SecureConversationMessageHeader));
2977 }
2978 
2980 UA_SecureConversationMessageHeader_new(void) {
2982 }
2983 
2984 static UA_INLINE UA_StatusCode
2985 UA_SecureConversationMessageHeader_copy(const UA_SecureConversationMessageHeader *src, UA_SecureConversationMessageHeader *dst) {
2986  *dst = *src;
2987  return UA_STATUSCODE_GOOD;
2988 }
2989 
2990 static UA_INLINE void
2991 UA_SecureConversationMessageHeader_deleteMembers(UA_SecureConversationMessageHeader *p) { }
2992 
2993 static UA_INLINE void
2994 UA_SecureConversationMessageHeader_delete(UA_SecureConversationMessageHeader *p) {
2996 }
2997 
2998 #if defined(__GNUC__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 6
2999 # pragma GCC diagnostic pop
3000 #endif
3001 
3002 #ifdef __cplusplus
3003 } // extern "C"
3004 #endif
3005 
3006 
3007 /*********************************** amalgamated original file "/home/iosb/sw/open62541/build/src_generated/ua_transport_generated_encoding_binary.h" ***********************************/
3008 
3009 /* Generated from Opc.Ua.Types.bsd, Custom.Opc.Ua.Transport.bsd with script /home/iosb/sw/open62541/tools/generate_datatypes.py
3010  * on host iosb-VirtualBox by user iosb at 2018-11-29 10:33:06 */
3011 
3012 
3013 /* SecureConversationMessageAbortBody */
3014 static UA_INLINE UA_StatusCode
3015 UA_SecureConversationMessageAbortBody_encodeBinary(const UA_SecureConversationMessageAbortBody *src, UA_ByteString *dst, size_t *offset) {
3016  return UA_encodeBinary(src, &UA_TRANSPORT[UA_TRANSPORT_SECURECONVERSATIONMESSAGEABORTBODY], NULL, NULL, dst, offset);
3017 }
3018 static UA_INLINE UA_StatusCode
3019 UA_SecureConversationMessageAbortBody_decodeBinary(const UA_ByteString *src, size_t *offset, UA_SecureConversationMessageAbortBody *dst) {
3020  return UA_decodeBinary(src, offset, dst, &UA_TRANSPORT[UA_TRANSPORT_SECURECONVERSATIONMESSAGEABORTBODY]);
3021 }
3022 
3023 /* SecureConversationMessageFooter */
3024 static UA_INLINE UA_StatusCode
3025 UA_SecureConversationMessageFooter_encodeBinary(const UA_SecureConversationMessageFooter *src, UA_ByteString *dst, size_t *offset) {
3026  return UA_encodeBinary(src, &UA_TRANSPORT[UA_TRANSPORT_SECURECONVERSATIONMESSAGEFOOTER], NULL, NULL, dst, offset);
3027 }
3028 static UA_INLINE UA_StatusCode
3029 UA_SecureConversationMessageFooter_decodeBinary(const UA_ByteString *src, size_t *offset, UA_SecureConversationMessageFooter *dst) {
3030  return UA_decodeBinary(src, offset, dst, &UA_TRANSPORT[UA_TRANSPORT_SECURECONVERSATIONMESSAGEFOOTER]);
3031 }
3032 
3033 /* TcpHelloMessage */
3034 static UA_INLINE UA_StatusCode
3035 UA_TcpHelloMessage_encodeBinary(const UA_TcpHelloMessage *src, UA_ByteString *dst, size_t *offset) {
3036  return UA_encodeBinary(src, &UA_TRANSPORT[UA_TRANSPORT_TCPHELLOMESSAGE], NULL, NULL, dst, offset);
3037 }
3038 static UA_INLINE UA_StatusCode
3039 UA_TcpHelloMessage_decodeBinary(const UA_ByteString *src, size_t *offset, UA_TcpHelloMessage *dst) {
3040  return UA_decodeBinary(src, offset, dst, &UA_TRANSPORT[UA_TRANSPORT_TCPHELLOMESSAGE]);
3041 }
3042 
3043 /* TcpErrorMessage */
3044 static UA_INLINE UA_StatusCode
3045 UA_TcpErrorMessage_encodeBinary(const UA_TcpErrorMessage *src, UA_ByteString *dst, size_t *offset) {
3046  return UA_encodeBinary(src, &UA_TRANSPORT[UA_TRANSPORT_TCPERRORMESSAGE], NULL, NULL, dst, offset);
3047 }
3048 static UA_INLINE UA_StatusCode
3049 UA_TcpErrorMessage_decodeBinary(const UA_ByteString *src, size_t *offset, UA_TcpErrorMessage *dst) {
3050  return UA_decodeBinary(src, offset, dst, &UA_TRANSPORT[UA_TRANSPORT_TCPERRORMESSAGE]);
3051 }
3052 
3053 /* MessageType */
3054 static UA_INLINE UA_StatusCode
3055 UA_MessageType_encodeBinary(const UA_MessageType *src, UA_ByteString *dst, size_t *offset) {
3056  return UA_encodeBinary(src, &UA_TRANSPORT[UA_TRANSPORT_MESSAGETYPE], NULL, NULL, dst, offset);
3057 }
3058 static UA_INLINE UA_StatusCode
3059 UA_MessageType_decodeBinary(const UA_ByteString *src, size_t *offset, UA_MessageType *dst) {
3060  return UA_decodeBinary(src, offset, dst, &UA_TRANSPORT[UA_TRANSPORT_MESSAGETYPE]);
3061 }
3062 
3063 /* AsymmetricAlgorithmSecurityHeader */
3064 static UA_INLINE UA_StatusCode
3065 UA_AsymmetricAlgorithmSecurityHeader_encodeBinary(const UA_AsymmetricAlgorithmSecurityHeader *src, UA_ByteString *dst, size_t *offset) {
3066  return UA_encodeBinary(src, &UA_TRANSPORT[UA_TRANSPORT_ASYMMETRICALGORITHMSECURITYHEADER], NULL, NULL, dst, offset);
3067 }
3068 static UA_INLINE UA_StatusCode
3069 UA_AsymmetricAlgorithmSecurityHeader_decodeBinary(const UA_ByteString *src, size_t *offset, UA_AsymmetricAlgorithmSecurityHeader *dst) {
3070  return UA_decodeBinary(src, offset, dst, &UA_TRANSPORT[UA_TRANSPORT_ASYMMETRICALGORITHMSECURITYHEADER]);
3071 }
3072 
3073 /* TcpAcknowledgeMessage */
3074 static UA_INLINE UA_StatusCode
3075 UA_TcpAcknowledgeMessage_encodeBinary(const UA_TcpAcknowledgeMessage *src, UA_ByteString *dst, size_t *offset) {
3076  return UA_encodeBinary(src, &UA_TRANSPORT[UA_TRANSPORT_TCPACKNOWLEDGEMESSAGE], NULL, NULL, dst, offset);
3077 }
3078 static UA_INLINE UA_StatusCode
3079 UA_TcpAcknowledgeMessage_decodeBinary(const UA_ByteString *src, size_t *offset, UA_TcpAcknowledgeMessage *dst) {
3080  return UA_decodeBinary(src, offset, dst, &UA_TRANSPORT[UA_TRANSPORT_TCPACKNOWLEDGEMESSAGE]);
3081 }
3082 
3083 /* SequenceHeader */
3084 static UA_INLINE UA_StatusCode
3085 UA_SequenceHeader_encodeBinary(const UA_SequenceHeader *src, UA_ByteString *dst, size_t *offset) {
3086  return UA_encodeBinary(src, &UA_TRANSPORT[UA_TRANSPORT_SEQUENCEHEADER], NULL, NULL, dst, offset);
3087 }
3088 static UA_INLINE UA_StatusCode
3089 UA_SequenceHeader_decodeBinary(const UA_ByteString *src, size_t *offset, UA_SequenceHeader *dst) {
3090  return UA_decodeBinary(src, offset, dst, &UA_TRANSPORT[UA_TRANSPORT_SEQUENCEHEADER]);
3091 }
3092 
3093 /* TcpMessageHeader */
3094 static UA_INLINE UA_StatusCode
3095 UA_TcpMessageHeader_encodeBinary(const UA_TcpMessageHeader *src, UA_ByteString *dst, size_t *offset) {
3096  return UA_encodeBinary(src, &UA_TRANSPORT[UA_TRANSPORT_TCPMESSAGEHEADER], NULL, NULL, dst, offset);
3097 }
3098 static UA_INLINE UA_StatusCode
3099 UA_TcpMessageHeader_decodeBinary(const UA_ByteString *src, size_t *offset, UA_TcpMessageHeader *dst) {
3100  return UA_decodeBinary(src, offset, dst, &UA_TRANSPORT[UA_TRANSPORT_TCPMESSAGEHEADER]);
3101 }
3102 
3103 /* ChunkType */
3104 static UA_INLINE UA_StatusCode
3105 UA_ChunkType_encodeBinary(const UA_ChunkType *src, UA_ByteString *dst, size_t *offset) {
3106  return UA_encodeBinary(src, &UA_TRANSPORT[UA_TRANSPORT_CHUNKTYPE], NULL, NULL, dst, offset);
3107 }
3108 static UA_INLINE UA_StatusCode
3109 UA_ChunkType_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ChunkType *dst) {
3110  return UA_decodeBinary(src, offset, dst, &UA_TRANSPORT[UA_TRANSPORT_CHUNKTYPE]);
3111 }
3112 
3113 /* SymmetricAlgorithmSecurityHeader */
3114 static UA_INLINE UA_StatusCode
3115 UA_SymmetricAlgorithmSecurityHeader_encodeBinary(const UA_SymmetricAlgorithmSecurityHeader *src, UA_ByteString *dst, size_t *offset) {
3116  return UA_encodeBinary(src, &UA_TRANSPORT[UA_TRANSPORT_SYMMETRICALGORITHMSECURITYHEADER], NULL, NULL, dst, offset);
3117 }
3118 static UA_INLINE UA_StatusCode
3119 UA_SymmetricAlgorithmSecurityHeader_decodeBinary(const UA_ByteString *src, size_t *offset, UA_SymmetricAlgorithmSecurityHeader *dst) {
3120  return UA_decodeBinary(src, offset, dst, &UA_TRANSPORT[UA_TRANSPORT_SYMMETRICALGORITHMSECURITYHEADER]);
3121 }
3122 
3123 /* SecureConversationMessageHeader */
3124 static UA_INLINE UA_StatusCode
3125 UA_SecureConversationMessageHeader_encodeBinary(const UA_SecureConversationMessageHeader *src, UA_ByteString *dst, size_t *offset) {
3126  return UA_encodeBinary(src, &UA_TRANSPORT[UA_TRANSPORT_SECURECONVERSATIONMESSAGEHEADER], NULL, NULL, dst, offset);
3127 }
3128 static UA_INLINE UA_StatusCode
3129 UA_SecureConversationMessageHeader_decodeBinary(const UA_ByteString *src, size_t *offset, UA_SecureConversationMessageHeader *dst) {
3130  return UA_decodeBinary(src, offset, dst, &UA_TRANSPORT[UA_TRANSPORT_SECURECONVERSATIONMESSAGEHEADER]);
3131 }
3132 
3133 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/ua_connection_internal.h" ***********************************/
3134 
3135 /* This Source Code Form is subject to the terms of the Mozilla Public
3136 * License, v. 2.0. If a copy of the MPL was not distributed with this
3137 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
3138 
3139 
3140 
3141 /* The network layer may receive chopped up messages since TCP is a streaming
3142  * protocol. Furthermore, the networklayer may operate on ringbuffers or
3143  * statically assigned memory.
3144  *
3145  * If an entire message is received, it is forwarded directly. But the memory
3146  * needs to be freed with the networklayer-specific mechanism. If a half message
3147  * is received, we copy it into a local buffer. Then, the stack-specific free
3148  * needs to be used.
3149  *
3150  * @param connection The connection
3151  * @param message The received message. The content may be overwritten when a
3152  * previsouly received buffer is completed.
3153  * @param realloced The Boolean value is set to true if the outgoing message has
3154  * been reallocated from the network layer.
3155  * @return Returns UA_STATUSCODE_GOOD or an error code. When an error occurs, the ingoing message
3156  * and the current buffer in the connection are freed. */
3159  UA_Boolean *realloced);
3160 
3161 /* Try to receive at least one complete chunk on the connection. This blocks the
3162  * current thread up to the given timeout.
3163  *
3164  * @param connection The connection
3165  * @param chunk The received chunk. The memory is allocated either by the
3166  * networklayer or internally.
3167  * @param realloced The Boolean value is set to true if the chunk has been
3168  * reallocated from the network layer.
3169  * @param timeout The timeout (in milliseconds) the method will block at most.
3170  * @return Returns UA_STATUSCODE_GOOD or an error code. When an error occurs,
3171  * the chunk buffer is returned empty. Upon a timeout,
3172  * UA_STATUSCODE_GOODNONCRITICALTIMEOUT is returned.
3173  */
3176  UA_Boolean *realloced, UA_UInt32 timeout);
3177 
3180 
3181 /* Split the given endpoint url into hostname and port. Some of the chunks are
3182  * returned as pointer.
3183  * @param endpointUrl The endpoint URL to split up
3184  * @param hostname the target array for hostname. Has to be at least 256 size.
3185  * @param port if url contains port, it will point to the beginning of port.
3186  * NULL otherwise. It may also include the path part, thus stop at
3187  * position of path pointer, if it is not NULL.
3188  * @param path points to the first occurance of '/' after the port or NULL if no
3189  * path in url
3190  * @return UA_STATUSCODE_BADOUTOFRANGE if url too long,
3191  * UA_STATUSCODE_BADATTRIBUTEIDINVALID if url not starting with
3192  * 'opc.tcp://', UA_STATUSCODE_GOOD on success */
3194 UA_EndpointUrl_split_ptr(const char *endpointUrl, char *hostname,
3195  const char ** port, const char ** path);
3196 
3197 
3198 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/ua_securechannel.h" ***********************************/
3199 
3200 /* This Source Code Form is subject to the terms of the Mozilla Public
3201 * License, v. 2.0. If a copy of the MPL was not distributed with this
3202 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
3203 
3204 
3205 
3206 struct UA_Session;
3207 typedef struct UA_Session UA_Session;
3208 
3210  LIST_ENTRY(SessionEntry) pointers;
3211  UA_Session *session; // Just a pointer. The session is held in the session manager or the client
3212 };
3213 
3214 /* For chunked requests */
3215 struct ChunkEntry {
3216  LIST_ENTRY(ChunkEntry) pointers;
3217  UA_UInt32 requestId;
3218  UA_ByteString bytes;
3219 };
3220 
3221 /* For chunked responses */
3222 typedef struct {
3228  UA_Boolean final;
3230 } UA_ChunkInfo;
3231 
3234  UA_ChannelSecurityToken securityToken; // the channelId is contained in the securityToken
3235  UA_ChannelSecurityToken nextSecurityToken; // the channelId is contained in the securityToken
3243  LIST_HEAD(session_pointerlist, SessionEntry) sessions;
3244  LIST_HEAD(chunk_pointerlist, ChunkEntry) chunks;
3245  //WinCC workaround, count numbers of activateSession requests by the client to
3246  //close SecureChannel and force the creation of a new Session
3247  UA_UInt32 invalidSessionAccessCounter;
3248 };
3249 
3252 
3254 
3258 
3260  const void *content, const UA_DataType *contentType);
3261 
3263 
3267 typedef void
3268 (UA_ProcessMessageCallback)(void *application, UA_SecureChannel *channel,
3269  UA_MessageType messageType, UA_UInt32 requestId,
3270  const UA_ByteString *message);
3271 
3274  UA_ProcessMessageCallback callback, void *application);
3275 
3279 #define UA_LOG_TRACE_CHANNEL(LOGGER, CHANNEL, MSG, ...) \
3280  UA_LOG_TRACE(LOGGER, UA_LOGCATEGORY_SECURECHANNEL, "Connection %i | SecureChannel %i | " MSG, \
3281  ((CHANNEL)->connection ? CHANNEL->connection->sockfd : 0), \
3282  (CHANNEL)->securityToken.channelId, ##__VA_ARGS__);
3283 
3284 #define UA_LOG_DEBUG_CHANNEL(LOGGER, CHANNEL, MSG, ...) \
3285  UA_LOG_DEBUG(LOGGER, UA_LOGCATEGORY_SECURECHANNEL, "Connection %i | SecureChannel %i | " MSG, \
3286  ((CHANNEL)->connection ? (CHANNEL)->connection->sockfd : 0), \
3287  (CHANNEL)->securityToken.channelId, ##__VA_ARGS__);
3288 
3289 #define UA_LOG_INFO_CHANNEL(LOGGER, CHANNEL, MSG, ...) \
3290  UA_LOG_INFO(LOGGER, UA_LOGCATEGORY_SECURECHANNEL, "Connection %i | SecureChannel %i | " MSG, \
3291  ((CHANNEL)->connection ? (CHANNEL)->connection->sockfd : 0), \
3292  (CHANNEL)->securityToken.channelId, ##__VA_ARGS__);
3293 
3294 #define UA_LOG_WARNING_CHANNEL(LOGGER, CHANNEL, MSG, ...) \
3295  UA_LOG_WARNING(LOGGER, UA_LOGCATEGORY_SECURECHANNEL, "Connection %i | SecureChannel %i | " MSG, \
3296  ((CHANNEL)->connection ? (CHANNEL)->connection->sockfd : 0), \
3297  (CHANNEL)->securityToken.channelId, ##__VA_ARGS__);
3298 
3299 #define UA_LOG_ERROR_CHANNEL(LOGGER, CHANNEL, MSG, ...) \
3300  UA_LOG_ERROR(LOGGER, UA_LOGCATEGORY_SECURECHANNEL, "Connection %i | SecureChannel %i | " MSG, \
3301  ((CHANNEL)->connection ? (CHANNEL)->connection->sockfd : 0), \
3302  (CHANNEL)->securityToken.channelId, ##__VA_ARGS__);
3303 
3304 #define UA_LOG_FATAL_CHANNEL(LOGGER, CHANNEL, MSG, ...) \
3305  UA_LOG_FATAL(LOGGER, UA_LOGCATEGORY_SECURECHANNEL, "Connection %i | SecureChannel %i | " MSG, \
3306  ((CHANNEL)->connection ? (CHANNEL)->connection->sockfd : 0), \
3307  (CHANNEL)->securityToken.channelId, ##__VA_ARGS__);
3308 
3309 
3310 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_nodes.h" ***********************************/
3311 
3312 /* This Source Code Form is subject to the terms of the Mozilla Public
3313 * License, v. 2.0. If a copy of the MPL was not distributed with this
3314 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
3315 
3316 
3317 #ifdef __cplusplus
3318 extern "C" {
3319 #endif
3320 
3321 
3359 #define UA_NODE_BASEATTRIBUTES \
3360  UA_NodeId nodeId; \
3361  UA_NodeClass nodeClass; \
3362  UA_QualifiedName browseName; \
3363  UA_LocalizedText displayName; \
3364  UA_LocalizedText description; \
3365  UA_UInt32 writeMask; \
3366  UA_UInt32 userWriteMask; \
3367  size_t referencesSize; \
3368  UA_ReferenceNode *references;
3369 
3370 typedef struct {
3372 } UA_Node;
3373 
3439 /* Indicates whether a variable contains data inline or whether it points to an
3440  * external data source */
3441 typedef enum {
3444 } UA_ValueSource;
3445 
3446 #define UA_NODE_VARIABLEATTRIBUTES \
3447  /* Constraints on possible values */ \
3448  UA_NodeId dataType; \
3449  UA_Int32 valueRank; \
3450  size_t arrayDimensionsSize; \
3451  UA_UInt32 *arrayDimensions; \
3452  \
3453  /* The current value */ \
3454  UA_ValueSource valueSource; \
3455  union { \
3456  struct { \
3457  UA_DataValue value; \
3458  UA_ValueCallback callback; \
3459  } data; \
3460  UA_DataSource dataSource; \
3461  } value;
3462 
3463 typedef struct {
3469  UA_Boolean historizing; /* currently unsupported */
3470 } UA_VariableNode;
3471 
3484 typedef struct {
3489 
3508 typedef struct {
3512 
3513  /* Members specific to open62541 */
3515  UA_MethodCallback attachedMethod;
3516 } UA_MethodNode;
3517 
3526 typedef struct {
3529 
3530  /* Members specific to open62541 */
3532 } UA_ObjectNode;
3533 
3543 typedef struct {
3546 
3547  /* Members specific to open62541 */
3548  UA_ObjectLifecycleManagement lifecycleManagement;
3550 
3653 typedef struct {
3659 
3674 typedef struct {
3677 } UA_DataTypeNode;
3678 
3688 typedef struct {
3692 } UA_ViewNode;
3693 
3694 #ifdef __cplusplus
3695 } // extern "C"
3696 #endif
3697 
3698 
3699 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/ua_session.h" ***********************************/
3700 
3701 /* This Source Code Form is subject to the terms of the Mozilla Public
3702 * License, v. 2.0. If a copy of the MPL was not distributed with this
3703 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
3704 
3705 
3706 
3707 #define UA_MAXCONTINUATIONPOINTS 5
3708 
3711  UA_ByteString identifier;
3712  UA_BrowseDescription browseDescription;
3713  UA_UInt32 continuationIndex;
3714  UA_UInt32 maxReferences;
3715 };
3716 
3717 struct UA_Subscription;
3719 
3720 #ifdef UA_ENABLE_SUBSCRIPTIONS
3721 typedef struct UA_PublishResponseEntry {
3722  SIMPLEQ_ENTRY(UA_PublishResponseEntry) listEntry;
3723  UA_UInt32 requestId;
3724  UA_PublishResponse response;
3725 } UA_PublishResponseEntry;
3726 #endif
3727 
3728 struct UA_Session {
3740  LIST_HEAD(ContinuationPointList, ContinuationPointEntry) continuationPoints;
3741 #ifdef UA_ENABLE_SUBSCRIPTIONS
3742  UA_UInt32 lastSubscriptionID;
3743  LIST_HEAD(UA_ListOfUASubscriptions, UA_Subscription) serverSubscriptions;
3744  SIMPLEQ_HEAD(UA_ListOfQueuedPublishResponses, UA_PublishResponseEntry) responseQueue;
3745 #endif
3746 };
3747 
3748 /* Local access to the services (for startup and maintenance) uses this Session
3749  * with all possible access rights (Session ID: 1) */
3750 extern UA_Session adminSession;
3751 
3752 void UA_Session_init(UA_Session *session);
3753 void UA_Session_deleteMembersCleanup(UA_Session *session, UA_Server *server);
3754 
3755 /* If any activity on a session happens, the timeout is extended */
3756 void UA_Session_updateLifetime(UA_Session *session);
3757 
3758 #ifdef UA_ENABLE_SUBSCRIPTIONS
3759 void UA_Session_addSubscription(UA_Session *session, UA_Subscription *newSubscription);
3760 
3762 UA_Session_getSubscriptionByID(UA_Session *session, UA_UInt32 subscriptionID);
3763 
3765 UA_Session_deleteSubscription(UA_Server *server, UA_Session *session,
3766  UA_UInt32 subscriptionID);
3767 
3768 UA_UInt32
3769 UA_Session_getUniqueSubscriptionID(UA_Session *session);
3770 #endif
3771 
3776 #define UA_LOG_TRACE_SESSION(LOGGER, SESSION, MSG, ...) \
3777  UA_LOG_TRACE(LOGGER, UA_LOGCATEGORY_SESSION, "Connection %i | SecureChannel %i | Session " UA_PRINTF_GUID_FORMAT " | " MSG, \
3778  ((SESSION)->channel ? ((SESSION)->channel->connection ? (SESSION)->channel->connection->sockfd : 0) : 0), \
3779  ((SESSION)->channel ? (SESSION)->channel->securityToken.channelId : 0), \
3780  UA_PRINTF_GUID_DATA((SESSION)->sessionId.identifier.guid), \
3781  ##__VA_ARGS__);
3782 
3783 #define UA_LOG_DEBUG_SESSION(LOGGER, SESSION, MSG, ...) \
3784  UA_LOG_DEBUG(LOGGER, UA_LOGCATEGORY_SESSION, "Connection %i | SecureChannel %i | Session " UA_PRINTF_GUID_FORMAT " | " MSG, \
3785  ((SESSION)->channel ? ((SESSION)->channel->connection ? (SESSION)->channel->connection->sockfd : 0) : 0), \
3786  ((SESSION)->channel ? (SESSION)->channel->securityToken.channelId : 0), \
3787  UA_PRINTF_GUID_DATA((SESSION)->sessionId.identifier.guid), \
3788  ##__VA_ARGS__);
3789 
3790 #define UA_LOG_INFO_SESSION(LOGGER, SESSION, MSG, ...) \
3791  UA_LOG_INFO(LOGGER, UA_LOGCATEGORY_SESSION, "Connection %i | SecureChannel %i | Session " UA_PRINTF_GUID_FORMAT " | " MSG, \
3792  ((SESSION)->channel ? ((SESSION)->channel->connection ? (SESSION)->channel->connection->sockfd : 0) : 0), \
3793  ((SESSION)->channel ? (SESSION)->channel->securityToken.channelId : 0), \
3794  UA_PRINTF_GUID_DATA((SESSION)->sessionId.identifier.guid), \
3795  ##__VA_ARGS__);
3796 
3797 #define UA_LOG_WARNING_SESSION(LOGGER, SESSION, MSG, ...) \
3798  UA_LOG_WARNING(LOGGER, UA_LOGCATEGORY_SESSION, "Connection %i | SecureChannel %i | Session " UA_PRINTF_GUID_FORMAT " | " MSG, \
3799  ((SESSION)->channel ? ((SESSION)->channel->connection ? (SESSION)->channel->connection->sockfd : 0) : 0), \
3800  ((SESSION)->channel ? (SESSION)->channel->securityToken.channelId : 0), \
3801  UA_PRINTF_GUID_DATA((SESSION)->sessionId.identifier.guid), \
3802  ##__VA_ARGS__);
3803 
3804 #define UA_LOG_ERROR_SESSION(LOGGER, SESSION, MSG, ...) \
3805  UA_LOG_ERROR(LOGGER, UA_LOGCATEGORY_SESSION, "Connection %i | SecureChannel %i | Session " UA_PRINTF_GUID_FORMAT " | " MSG, \
3806  ((SESSION)->channel ? ((SESSION)->channel->connection ? (SESSION)->channel->connection->sockfd : 0) : 0), \
3807  ((SESSION)->channel ? (SESSION)->channel->securityToken.channelId : 0), \
3808  UA_PRINTF_GUID_DATA((SESSION)->sessionId.identifier.guid), \
3809  ##__VA_ARGS__);
3810 
3811 #define UA_LOG_FATAL_SESSION(LOGGER, SESSION, MSG, ...) \
3812  UA_LOG_FATAL(LOGGER, UA_LOGCATEGORY_SESSION, "Connection %i | SecureChannel %i | Session " UA_PRINTF_GUID_FORMAT " | " MSG, \
3813  ((SESSION)->channel ? ((SESSION)->channel->connection ? (SESSION)->channel->connection->sockfd : 0) : 0), \
3814  ((SESSION)->channel ? (SESSION)->channel->securityToken.channelId : 0), \
3815  UA_PRINTF_GUID_DATA((SESSION)->sessionId.identifier.guid), \
3816  ##__VA_ARGS__);
3817 
3818 
3819 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_subscription.h" ***********************************/
3820 
3821 /* This Source Code Form is subject to the terms of the Mozilla Public
3822 * License, v. 2.0. If a copy of the MPL was not distributed with this
3823 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
3824 
3825 
3826 
3827 /*****************/
3828 /* MonitoredItem */
3829 /*****************/
3830 
3831 typedef enum {
3836 
3839  UA_UInt32 clientHandle;
3840  UA_DataValue value;
3842 
3843 typedef struct UA_MonitoredItem {
3844  LIST_ENTRY(UA_MonitoredItem) listEntry;
3845 
3846  /* Settings */
3847  UA_Subscription *subscription;
3848  UA_UInt32 itemId;
3849  UA_MonitoredItemType monitoredItemType;
3850  UA_TimestampsToReturn timestampsToReturn;
3851  UA_MonitoringMode monitoringMode;
3852  UA_NodeId monitoredNodeId;
3853  UA_UInt32 attributeID;
3854  UA_UInt32 clientHandle;
3855  UA_Double samplingInterval; // [ms]
3856  UA_UInt32 currentQueueSize;
3857  UA_UInt32 maxQueueSize;
3858  UA_Boolean discardOldest;
3859  UA_String indexRange;
3860  // TODO: dataEncoding is hardcoded to UA binary
3861  UA_DataChangeTrigger trigger;
3862 
3863  /* Sample Job */
3864  UA_Guid sampleJobGuid;
3865  UA_Boolean sampleJobIsRegistered;
3866 
3867  /* Sample Queue */
3868  UA_ByteString lastSampledValue;
3869  TAILQ_HEAD(QueueOfQueueDataValues, MonitoredItem_queuedValue) queue;
3871 
3873 void MonitoredItem_delete(UA_Server *server, UA_MonitoredItem *monitoredItem);
3874 void UA_MoniteredItem_SampleCallback(UA_Server *server, UA_MonitoredItem *monitoredItem);
3877 
3878 /****************/
3879 /* Subscription */
3880 /****************/
3881 
3884  UA_NotificationMessage message;
3886 
3887 /* We use only a subset of the states defined in the standard */
3888 typedef enum {
3889  /* UA_SUBSCRIPTIONSTATE_CLOSED */
3890  /* UA_SUBSCRIPTIONSTATE_CREATING */
3895 
3897  LIST_ENTRY(UA_Subscription) listEntry;
3898 
3899  /* Settings */
3900  UA_Session *session;
3901  UA_UInt32 lifeTimeCount;
3902  UA_UInt32 maxKeepAliveCount;
3903  UA_Double publishingInterval; /* in ms */
3904  UA_UInt32 subscriptionID;
3905  UA_UInt32 notificationsPerPublish;
3906  UA_Boolean publishingEnabled;
3907  UA_UInt32 priority;
3908 
3909  /* Runtime information */
3910  UA_SubscriptionState state;
3911  UA_UInt32 sequenceNumber;
3912  UA_UInt32 currentKeepAliveCount;
3913  UA_UInt32 currentLifetimeCount;
3914  UA_UInt32 lastMonitoredItemId;
3915 
3916  /* Publish Job */
3917  UA_Guid publishJobGuid;
3918  UA_Boolean publishJobIsRegistered;
3919 
3920  /* MonitoredItems */
3921  LIST_HEAD(UA_ListOfUAMonitoredItems, UA_MonitoredItem) monitoredItems;
3922 
3923  /* Retransmission Queue */
3924  TAILQ_HEAD(UA_ListOfNotificationMessages, UA_NotificationMessageEntry) retransmissionQueue;
3925  UA_UInt32 retransmissionQueueSize;
3926 };
3927 
3928 UA_Subscription *UA_Subscription_new(UA_Session *session, UA_UInt32 subscriptionID);
3929 void UA_Subscription_deleteMembers(UA_Subscription *subscription, UA_Server *server);
3932 
3935  UA_UInt32 monitoredItemID);
3936 
3939 
3941 
3944 
3945 void
3947  UA_NodeId *sessionToken);
3948 
3949 
3950 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_nodestore.h" ***********************************/
3951 
3952 /* This Source Code Form is subject to the terms of the Mozilla Public
3953 * License, v. 2.0. If a copy of the MPL was not distributed with this
3954 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
3955 
3956 
3957 #ifdef __cplusplus
3958 extern "C" {
3959 #endif
3960 
3961 
3967 struct UA_NodeStore;
3969 
3973 /* Create a new nodestore */
3975 
3976 /* Delete the nodestore and all nodes in it. Do not call from a read-side
3977  critical section (multithreading). */
3979 
3988 /* Create an editable node of the given NodeClass. */
3990 #define UA_NodeStore_newObjectNode() \
3991  (UA_ObjectNode*)UA_NodeStore_newNode(UA_NODECLASS_OBJECT)
3992 #define UA_NodeStore_newMethodNode() \
3993  (UA_MethodNode*)UA_NodeStore_newNode(UA_NODECLASS_METHOD)
3994 #define UA_NodeStore_newObjectTypeNode() \
3995  (UA_ObjectTypeNode*)UA_NodeStore_newNode(UA_NODECLASS_OBJECTTYPE)
3996 #define UA_NodeStore_newVariableTypeNode() \
3997  (UA_VariableTypeNode*)UA_NodeStore_newNode(UA_NODECLASS_VARIABLETYPE)
3998 #define UA_NodeStore_newReferenceTypeNode() \
3999  (UA_ReferenceTypeNode*)UA_NodeStore_newNode(UA_NODECLASS_REFERENCETYPE)
4000 #define UA_NodeStore_newDataTypeNode() \
4001  (UA_DataTypeNode*)UA_NodeStore_newNode(UA_NODECLASS_DATATYPE)
4002 #define UA_NodeStore_newViewNode() \
4003  (UA_ViewNode*)UA_NodeStore_newNode(UA_NODECLASS_VIEW)
4004 
4005 /* Enable read/write AccessLevel flags for variables by default. More complete
4006  * access control is added starting in the 0.3 branch. */
4007 static UA_VariableNode *
4008 UA_NodeStore_newVariableNode(void) {
4011  if(vn)
4012  vn->accessLevel = 3; /* Enable read/write */
4013  return vn;
4014 }
4015 
4016 /* Delete an editable node. */
4017 void UA_NodeStore_deleteNode(UA_Node *node);
4018 
4022 /* Inserts a new node into the nodestore. If the nodeid is zero, then a fresh
4023  * numeric nodeid from namespace 1 is assigned. If insertion fails, the node is
4024  * deleted. */
4026 
4027 /* The returned node is immutable. */
4028 const UA_Node * UA_NodeStore_get(UA_NodeStore *ns, const UA_NodeId *nodeid);
4029 
4030 /* Returns an editable copy of a node (needs to be deleted with the deleteNode
4031  function or inserted / replaced into the nodestore). */
4032 UA_Node * UA_NodeStore_getCopy(UA_NodeStore *ns, const UA_NodeId *nodeid);
4033 
4034 /* To replace a node, get an editable copy of the node, edit and replace with
4035  * this function. If the node was already replaced since the copy was made,
4036  * UA_STATUSCODE_BADINTERNALERROR is returned. If the nodeid is not found,
4037  * UA_STATUSCODE_BADNODEIDUNKNOWN is returned. In both error cases, the editable
4038  * node is deleted. */
4040 
4041 /* Remove a node in the nodestore. */
4043 
4049 typedef void (*UA_NodeStore_nodeVisitor)(const UA_Node *node);
4051 
4052 #ifdef __cplusplus
4053 } // extern "C"
4054 #endif
4055 
4056 
4057 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_session_manager.h" ***********************************/
4058 
4059 /* This Source Code Form is subject to the terms of the Mozilla Public
4060 * License, v. 2.0. If a copy of the MPL was not distributed with this
4061 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
4062 
4063 
4064 
4065 typedef struct session_list_entry {
4066  LIST_ENTRY(session_list_entry) pointers;
4067  UA_Session session;
4069 
4070 typedef struct UA_SessionManager {
4071  LIST_HEAD(session_list, session_list_entry) sessions; // doubly-linked list of sessions
4072  UA_UInt32 currentSessionCount;
4073  UA_Server *server;
4075 
4078 
4079 /* Deletes all sessions */
4081 
4082 /* Deletes all sessions that have timed out. Deletion is implemented via a
4083  * delayed callback. So all currently scheduled jobs with a pointer to the
4084  * session can complete. */
4086  UA_DateTime nowMonotonic);
4087 
4090  const UA_CreateSessionRequest *request, UA_Session **session);
4091 
4094 
4095 UA_Session *
4097 
4098 
4099 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_securechannel_manager.h" ***********************************/
4100 
4101 /* This Source Code Form is subject to the terms of the Mozilla Public
4102 * License, v. 2.0. If a copy of the MPL was not distributed with this
4103 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
4104 
4105 
4106 
4107 typedef struct channel_list_entry {
4109  LIST_ENTRY(channel_list_entry) pointers;
4111 
4112 typedef struct UA_SecureChannelManager {
4113  LIST_HEAD(channel_list, channel_list_entry) channels; // doubly-linked list of channels
4114  UA_UInt32 currentChannelCount;
4115  UA_UInt32 lastChannelId;
4116  UA_UInt32 lastTokenId;
4117  UA_Server *server;
4119 
4122 
4123 /* Remove a all securechannels */
4124 void
4126 
4127 /* Remove timed out securechannels with a delayed callback. So all currently
4128  * scheduled jobs with a pointer to a securechannel can finish first. */
4129 void
4131  UA_DateTime nowMonotonic);
4132 
4135  const UA_OpenSecureChannelRequest *request,
4136  UA_OpenSecureChannelResponse *response);
4137 
4140  const UA_OpenSecureChannelRequest *request,
4141  UA_OpenSecureChannelResponse *response);
4142 
4145 
4148 
4149 
4150 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_server_internal.h" ***********************************/
4151 
4152 /* This Source Code Form is subject to the terms of the Mozilla Public
4153 * License, v. 2.0. If a copy of the MPL was not distributed with this
4154 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
4155 
4156 
4157 
4158 #define ANONYMOUS_POLICY "open62541-anonymous-policy"
4159 #define USERNAME_POLICY "open62541-username-policy"
4160 
4161 /* The general idea of RCU is to delay freeing nodes (or any callback invoked
4162  * with call_rcu) until all threads have left their critical section. Thus we
4163  * can delete nodes safely in concurrent operations. The macros UA_RCU_LOCK and
4164  * UA_RCU_UNLOCK are used to test during debugging that we do not nest read-side
4165  * critical sections (although this is generally allowed). */
4166 #ifdef UA_ENABLE_MULTITHREADING
4167 # define _LGPL_SOURCE
4168 # include <urcu.h>
4169 # include <urcu/lfstack.h>
4170 # ifdef NDEBUG
4171 # define UA_RCU_LOCK() rcu_read_lock()
4172 # define UA_RCU_UNLOCK() rcu_read_unlock()
4173 # define UA_ASSERT_RCU_LOCKED()
4174 # define UA_ASSERT_RCU_UNLOCKED()
4175 # else
4176  extern UA_THREAD_LOCAL bool rcu_locked;
4177 # define UA_ASSERT_RCU_LOCKED() assert(rcu_locked)
4178 # define UA_ASSERT_RCU_UNLOCKED() assert(!rcu_locked)
4179 # define UA_RCU_LOCK() do { \
4180  UA_ASSERT_RCU_UNLOCKED(); \
4181  rcu_locked = true; \
4182  rcu_read_lock(); } while(0)
4183 # define UA_RCU_UNLOCK() do { \
4184  UA_ASSERT_RCU_LOCKED(); \
4185  rcu_locked = false; \
4186  rcu_read_unlock(); } while(0)
4187 # endif
4188 #else
4189 # define UA_RCU_LOCK()
4190 # define UA_RCU_UNLOCK()
4191 # define UA_ASSERT_RCU_LOCKED()
4192 # define UA_ASSERT_RCU_UNLOCKED()
4193 #endif
4194 
4195 
4196 #ifdef UA_ENABLE_MULTITHREADING
4197 typedef struct {
4198  UA_Server *server;
4199  pthread_t thr;
4200  UA_UInt32 counter;
4201  volatile UA_Boolean running;
4202  char padding[64 - sizeof(void*) - sizeof(pthread_t) -
4203  sizeof(UA_UInt32) - sizeof(UA_Boolean)]; // separate cache lines
4204 } UA_Worker;
4205 #endif
4206 
4207 #if defined(UA_ENABLE_METHODCALLS) && defined(UA_ENABLE_SUBSCRIPTIONS)
4208 /* Internally used context to a session 'context' of the current mehtod call */
4209 extern UA_THREAD_LOCAL UA_Session* methodCallSession;
4210 #endif
4211 
4212 struct UA_Server {
4213  /* Meta */
4217 
4218  /* Security */
4221 
4222  /* Address Space */
4224 
4227 
4228 
4229  /* Jobs with a repetition interval */
4230  LIST_HEAD(RepeatedJobsList, RepeatedJob) repeatedJobs;
4231 
4232 #ifndef UA_ENABLE_MULTITHREADING
4233  SLIST_HEAD(DelayedJobsList, UA_DelayedJob) delayedCallbacks;
4234 #else
4235  /* Dispatch queue head for the worker threads (the tail should not be in the same cache line) */
4236  struct cds_wfcq_head dispatchQueue_head;
4237  UA_Worker *workers; /* there are nThread workers in a running server */
4238  struct cds_lfs_stack mainLoopJobs; /* Work that shall be executed only in the main loop and not
4239  by worker threads */
4240  struct DelayedJobs *delayedJobs;
4241  pthread_cond_t dispatchQueue_condition; /* so the workers don't spin if the queue is empty */
4242  pthread_mutex_t dispatchQueue_mutex; /* mutex for access to condition variable */
4243  struct cds_wfcq_tail dispatchQueue_tail; /* Dispatch queue tail for the worker threads */
4244 #endif
4245 
4246  /* Config is the last element so that MSVC allows the usernamePasswordLogins
4247  field with zero-sized array */
4248  UA_ServerConfig config;
4249 };
4250 
4251 /*****************/
4252 /* Node Handling */
4253 /*****************/
4254 
4257 
4258 /* Calls callback on the node. In the multithreaded case, the node is copied before and replaced in
4259  the nodestore. */
4261 UA_StatusCode UA_Server_editNode(UA_Server *server, UA_Session *session, const UA_NodeId *nodeId,
4262  UA_EditNodeCallback callback, const void *data);
4263 
4264 /********************/
4265 /* Event Processing */
4266 /********************/
4267 
4268 void UA_Server_processBinaryMessage(UA_Server *server, UA_Connection *connection,
4269  const UA_ByteString *message);
4270 
4271 UA_StatusCode UA_Server_delayedCallback(UA_Server *server, UA_ServerCallback callback, void *data);
4272 UA_StatusCode UA_Server_delayedFree(UA_Server *server, void *data);
4273 void UA_Server_deleteAllRepeatedJobs(UA_Server *server);
4274 
4275 /* Add an existing node. The node is assumed to be "finished", i.e. no
4276  * instantiation from inheritance is necessary. Instantiationcallback and
4277  * addedNodeId may be NULL. */
4279 Service_AddNodes_existing(UA_Server *server, UA_Session *session, UA_Node *node,
4280  const UA_NodeId *parentNodeId,
4281  const UA_NodeId *referenceTypeId,
4282  const UA_NodeId *typeDefinition,
4283  UA_InstantiationCallback *instantiationCallback,
4284  UA_NodeId *addedNodeId);
4285 
4286 /*********************/
4287 /* Utility Functions */
4288 /*********************/
4289 
4291 parse_numericrange(const UA_String *str, UA_NumericRange *range);
4292 
4293 UA_UInt16 addNamespace(UA_Server *server, const UA_String name);
4294 
4295 UA_Boolean
4296 UA_Node_hasSubTypeOrInstances(const UA_Node *node);
4297 
4298 const UA_VariableTypeNode *
4299 getVariableNodeType(UA_Server *server, const UA_VariableNode *node);
4300 
4301 const UA_ObjectTypeNode *
4302 getObjectNodeType(UA_Server *server, const UA_ObjectNode *node);
4303 
4304 /* Returns an array with all subtype nodeids (including the root). Subtypes need
4305  * to have the same nodeClass as root and are (recursively) related with a
4306  * hasSubType reference. Since multi-inheritance is possible, we test for
4307  * duplicates and return evey nodeid at most once. */
4309 getTypeHierarchy(UA_NodeStore *ns, const UA_Node *rootRef, UA_Boolean inverse,
4310  UA_NodeId **typeHierarchy, size_t *typeHierarchySize);
4311 
4312 /* Recursively searches "upwards" in the tree following specific reference types */
4313 UA_Boolean
4314 isNodeInTree(UA_NodeStore *ns, const UA_NodeId *leafNode,
4315  const UA_NodeId *nodeToFind, const UA_NodeId *referenceTypeIds,
4316  size_t referenceTypeIdsSize);
4317 
4318 const UA_Node *
4319 getNodeType(UA_Server *server, const UA_Node *node);
4320 
4321 /***************************************/
4322 /* Check Information Model Consistency */
4323 /***************************************/
4324 
4326 readValueAttribute(UA_Server *server, const UA_VariableNode *vn, UA_DataValue *v);
4327 
4329 typeCheckValue(UA_Server *server, const UA_NodeId *targetDataTypeId,
4330  UA_Int32 targetValueRank, size_t targetArrayDimensionsSize,
4331  const UA_UInt32 *targetArrayDimensions, const UA_Variant *value,
4332  const UA_NumericRange *range, UA_Variant *editableValue);
4333 
4335 writeDataTypeAttribute(UA_Server *server, UA_VariableNode *node,
4336  const UA_NodeId *dataType, const UA_NodeId *constraintDataType);
4337 
4339 compatibleArrayDimensions(size_t constraintArrayDimensionsSize,
4340  const UA_UInt32 *constraintArrayDimensions,
4341  size_t testArrayDimensionsSize,
4342  const UA_UInt32 *testArrayDimensions);
4343 
4345 writeValueRankAttribute(UA_Server *server, UA_VariableNode *node, UA_Int32 valueRank,
4346  UA_Int32 constraintValueRank);
4347 
4349 writeValueAttribute(UA_Server *server, UA_VariableNode *node,
4350  const UA_DataValue *value, const UA_String *indexRange);
4351 
4352 /*******************/
4353 /* Single-Services */
4354 /*******************/
4355 
4356 /* Some services take an array of "independent" requests. The single-services
4357  are stored here to keep ua_services.h clean for documentation purposes. */
4358 
4359 void Service_Browse_single(UA_Server *server, UA_Session *session,
4360  struct ContinuationPointEntry *cp,
4361  const UA_BrowseDescription *descr,
4362  UA_UInt32 maxrefs, UA_BrowseResult *result);
4363 
4364 void Service_Read_single(UA_Server *server, UA_Session *session,
4365  UA_TimestampsToReturn timestamps,
4366  const UA_ReadValueId *id, UA_DataValue *v);
4367 
4368 void Service_Call_single(UA_Server *server, UA_Session *session,
4369  const UA_CallMethodRequest *request,
4370  UA_CallMethodResult *result);
4371 
4372 
4373 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_services.h" ***********************************/
4374 
4375 /* This Source Code Form is subject to the terms of the Mozilla Public
4376 * License, v. 2.0. If a copy of the MPL was not distributed with this
4377 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
4378 
4379 
4380 #ifdef __cplusplus
4381 extern "C" {
4382 #endif
4383 
4384 
4403 /* Most services take as input the server, the current session and pointers to
4404  * the request and response structures. Possible error codes are returned as
4405  * part of the response. */
4406 typedef void (*UA_Service)(UA_Server*, UA_Session*,
4407  const void *request, void *response);
4408 
4414 void Service_FindServers(UA_Server *server, UA_Session *session,
4415  const UA_FindServersRequest *request,
4416  UA_FindServersResponse *response);
4417 
4418 /* Returns the Endpoints supported by a Server and all of the configuration
4419  * information required to establish a SecureChannel and a Session. */
4420 void Service_GetEndpoints(UA_Server *server, UA_Session *session,
4421  const UA_GetEndpointsRequest *request,
4422  UA_GetEndpointsResponse *response);
4423 
4424 /* Not Implemented: Service_RegisterServer */
4425 
4432 /* Open or renew a SecureChannel that can be used to ensure Confidentiality and
4433  * Integrity for Message exchange during a Session. */
4434 void Service_OpenSecureChannel(UA_Server *server, UA_Connection *connection,
4435  const UA_OpenSecureChannelRequest *request,
4436  UA_OpenSecureChannelResponse *response);
4437 
4438 /* Used to terminate a SecureChannel. */
4439 void Service_CloseSecureChannel(UA_Server *server, UA_SecureChannel *channel);
4440 
4446 /* Used by an OPC UA Client to create a Session and the Server returns two
4447  * values which uniquely identify the Session. The first value is the sessionId
4448  * which is used to identify the Session in the audit logs and in the Server's
4449  * address space. The second is the authenticationToken which is used to
4450  * associate an incoming request with a Session. */
4451 void Service_CreateSession(UA_Server *server, UA_SecureChannel *channel,
4452  const UA_CreateSessionRequest *request,
4453  UA_CreateSessionResponse *response);
4454 
4455 /* Used by the Client to submit its SoftwareCertificates to the Server for
4456  * validation and to specify the identity of the user associated with the
4457  * Session. This Service request shall be issued by the Client before it issues
4458  * any other Service request after CreateSession. Failure to do so shall cause
4459  * the Server to close the Session. */
4460 void Service_ActivateSession(UA_Server *server, UA_SecureChannel *channel,
4461  UA_Session *session,
4462  const UA_ActivateSessionRequest *request,
4463  UA_ActivateSessionResponse *response);
4464 
4465 /* Used to terminate a Session. */
4466 void Service_CloseSession(UA_Server *server, UA_Session *session,
4467  const UA_CloseSessionRequest *request,
4468  UA_CloseSessionResponse *response);
4469 
4470 /* Not Implemented: Service_Cancel */
4471 
4479 /* Used to add one or more Nodes into the AddressSpace hierarchy. */
4480 void Service_AddNodes(UA_Server *server, UA_Session *session,
4481  const UA_AddNodesRequest *request,
4482  UA_AddNodesResponse *response);
4483 
4484 /* Used to add one or more References to one or more Nodes. */
4485 void Service_AddReferences(UA_Server *server, UA_Session *session,
4486  const UA_AddReferencesRequest *request,
4487  UA_AddReferencesResponse *response);
4488 
4489 /* Used to delete one or more Nodes from the AddressSpace. */
4490 void Service_DeleteNodes(UA_Server *server, UA_Session *session,
4491  const UA_DeleteNodesRequest *request,
4492  UA_DeleteNodesResponse *response);
4493 
4494 /* Used to delete one or more References of a Node. */
4495 void Service_DeleteReferences(UA_Server *server, UA_Session *session,
4496  const UA_DeleteReferencesRequest *request,
4497  UA_DeleteReferencesResponse *response);
4498 
4506 /* Used to discover the References of a specified Node. The browse can be
4507  * further limited by the use of a View. This Browse Service also supports a
4508  * primitive filtering capability. */
4509 void Service_Browse(UA_Server *server, UA_Session *session,
4510  const UA_BrowseRequest *request,
4511  UA_BrowseResponse *response);
4512 
4513 /* Used to request the next set of Browse or BrowseNext response information
4514  * that is too large to be sent in a single response. "Too large" in this
4515  * context means that the Server is not able to return a larger response or that
4516  * the number of results to return exceeds the maximum number of results to
4517  * return that was specified by the Client in the original Browse request. */
4518 void Service_BrowseNext(UA_Server *server, UA_Session *session,
4519  const UA_BrowseNextRequest *request,
4520  UA_BrowseNextResponse *response);
4521 
4522 /* Used to translate textual node paths to their respective ids. */
4523 void Service_TranslateBrowsePathsToNodeIds(UA_Server *server, UA_Session *session,
4526 
4527 /* Used by Clients to register the Nodes that they know they will access
4528  * repeatedly (e.g. Write, Call). It allows Servers to set up anything needed so
4529  * that the access operations will be more efficient. */
4530 void Service_RegisterNodes(UA_Server *server, UA_Session *session,
4531  const UA_RegisterNodesRequest *request,
4532  UA_RegisterNodesResponse *response);
4533 
4534 /* This Service is used to unregister NodeIds that have been obtained via the
4535  * RegisterNodes service. */
4536 void Service_UnregisterNodes(UA_Server *server, UA_Session *session,
4537  const UA_UnregisterNodesRequest *request,
4538  UA_UnregisterNodesResponse *response);
4539 
4550 /* Not Implemented: Service_QueryFirst */
4551 /* Not Impelemented: Service_QueryNext */
4552 
4558 /* Used to read one or more Attributes of one or more Nodes. For constructed
4559  * Attribute values whose elements are indexed, such as an array, this Service
4560  * allows Clients to read the entire set of indexed values as a composite, to
4561  * read individual elements or to read ranges of elements of the composite. */
4562 void Service_Read(UA_Server *server, UA_Session *session,
4563  const UA_ReadRequest *request,
4564  UA_ReadResponse *response);
4565 
4566 /* Used to write one or more Attributes of one or more Nodes. For constructed
4567  * Attribute values whose elements are indexed, such as an array, this Service
4568  * allows Clients to write the entire set of indexed values as a composite, to
4569  * write individual elements or to write ranges of elements of the composite. */
4570 void Service_Write(UA_Server *server, UA_Session *session,
4571  const UA_WriteRequest *request,
4572  UA_WriteResponse *response);
4573 
4574 /* Not Implemented: Service_HistoryRead */
4575 /* Not Implemented: Service_HistoryUpdate */
4576 
4585 /* Used to call (invoke) a list of Methods. Each method call is invoked within
4586  * the context of an existing Session. If the Session is terminated, the results
4587  * of the method's execution cannot be returned to the Client and are
4588  * discarded. */
4589 void Service_Call(UA_Server *server, UA_Session *session,
4590  const UA_CallRequest *request,
4591  UA_CallResponse *response);
4592 
4599 /* Used to create and add one or more MonitoredItems to a Subscription. A
4600  * MonitoredItem is deleted automatically by the Server when the Subscription is
4601  * deleted. Deleting a MonitoredItem causes its entire set of triggered item
4602  * links to be deleted, but has no effect on the MonitoredItems referenced by
4603  * the triggered items. */
4604 void Service_CreateMonitoredItems(UA_Server *server, UA_Session *session,
4605  const UA_CreateMonitoredItemsRequest *request,
4607 
4608 /* Used to remove one or more MonitoredItems of a Subscription. When a
4609  * MonitoredItem is deleted, its triggered item links are also deleted. */
4610 void Service_DeleteMonitoredItems(UA_Server *server, UA_Session *session,
4611  const UA_DeleteMonitoredItemsRequest *request,
4613 
4614 void Service_ModifyMonitoredItems(UA_Server *server, UA_Session *session,
4615  const UA_ModifyMonitoredItemsRequest *request,
4617 
4618 /* Used to set the monitoring mode for one or more MonitoredItems of a
4619  Subscription. */
4620 void Service_SetMonitoringMode(UA_Server *server, UA_Session *session,
4621  const UA_SetMonitoringModeRequest *request,
4622  UA_SetMonitoringModeResponse *response);
4623 
4624 /* Not Implemented: Service_SetTriggering */
4625 
4630 /* Used to create a Subscription. Subscriptions monitor a set of MonitoredItems
4631  * for Notifications and return them to the Client in response to Publish
4632  * requests. */
4633 void Service_CreateSubscription(UA_Server *server, UA_Session *session,
4634  const UA_CreateSubscriptionRequest *request,
4635  UA_CreateSubscriptionResponse *response);
4636 
4637 /* Used to modify a Subscription. */
4638 void Service_ModifySubscription(UA_Server *server, UA_Session *session,
4639  const UA_ModifySubscriptionRequest *request,
4640  UA_ModifySubscriptionResponse *response);
4641 
4642 /* Used to enable sending of Notifications on one or more Subscriptions. */
4643 void Service_SetPublishingMode(UA_Server *server, UA_Session *session,
4644  const UA_SetPublishingModeRequest *request,
4645  UA_SetPublishingModeResponse *response);
4646 
4647 /* Used for two purposes. First, it is used to acknowledge the receipt of
4648  * NotificationMessages for one or more Subscriptions. Second, it is used to
4649  * request the Server to return a NotificationMessage or a keep-alive
4650  * Message.
4651  *
4652  * Note that the service signature is an exception and does not contain a
4653  * pointer to a PublishResponse. That is because the service queues up publish
4654  * requests internally and sends responses asynchronously based on timeouts. */
4655 void Service_Publish(UA_Server *server, UA_Session *session,
4656  const UA_PublishRequest *request, UA_UInt32 requestId);
4657 
4658 /* Requests the Subscription to republish a NotificationMessage from its
4659  * retransmission queue. */
4660 void Service_Republish(UA_Server *server, UA_Session *session,
4661  const UA_RepublishRequest *request,
4662  UA_RepublishResponse *response);
4663 
4664 /* Invoked to delete one or more Subscriptions that belong to the Client's
4665  * Session. */
4666 void Service_DeleteSubscriptions(UA_Server *server, UA_Session *session,
4667  const UA_DeleteSubscriptionsRequest *request,
4668  UA_DeleteSubscriptionsResponse *response);
4669 
4670 /* Not Implemented: Service_TransferSubscription */
4671 
4672 #ifdef __cplusplus
4673 } // extern "C"
4674 #endif
4675 
4676 
4677 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/client/ua_client_internal.h" ***********************************/
4678 
4679 /* This Source Code Form is subject to the terms of the Mozilla Public
4680 * License, v. 2.0. If a copy of the MPL was not distributed with this
4681 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
4682 
4683 
4684 
4685 /**************************/
4686 /* Subscriptions Handling */
4687 /**************************/
4688 
4689 #ifdef UA_ENABLE_SUBSCRIPTIONS
4690 
4691 typedef struct UA_Client_NotificationsAckNumber {
4692  LIST_ENTRY(UA_Client_NotificationsAckNumber) listEntry;
4694 } UA_Client_NotificationsAckNumber;
4695 
4696 typedef struct UA_Client_MonitoredItem {
4697  LIST_ENTRY(UA_Client_MonitoredItem) listEntry;
4698  UA_UInt32 monitoredItemId;
4699  UA_UInt32 monitoringMode;
4700  UA_NodeId monitoredNodeId;
4701  UA_UInt32 attributeID;
4702  UA_UInt32 clientHandle;
4703  UA_Double samplingInterval;
4704  UA_UInt32 queueSize;
4705  UA_Boolean discardOldest;
4706  void (*handler)(UA_UInt32 monId, UA_DataValue *value, void *context);
4707  void *handlerContext;
4708 } UA_Client_MonitoredItem;
4709 
4710 typedef struct UA_Client_Subscription {
4711  LIST_ENTRY(UA_Client_Subscription) listEntry;
4712  UA_UInt32 lifeTime;
4713  UA_UInt32 keepAliveCount;
4714  UA_Double publishingInterval;
4715  UA_UInt32 subscriptionID;
4716  UA_UInt32 notificationsPerPublish;
4717  UA_UInt32 priority;
4718  LIST_HEAD(UA_ListOfClientMonitoredItems, UA_Client_MonitoredItem) monitoredItems;
4719 } UA_Client_Subscription;
4720 
4721 void UA_Client_Subscriptions_forceDelete(UA_Client *client, UA_Client_Subscription *sub);
4722 
4723 #endif
4724 
4725 /**********/
4726 /* Client */
4727 /**********/
4728 
4729 typedef enum {
4733 
4734 struct UA_Client {
4735  /* State */
4736  UA_ClientState state;
4737  UA_ClientConfig config;
4738 
4739  /* Connection */
4742 
4743  /* SecureChannel */
4747 
4748  /* Authentication */
4749  UA_Client_Authentication authenticationMethod;
4752 
4753  /* Session */
4757 
4758  /* Subscriptions */
4759 #ifdef UA_ENABLE_SUBSCRIPTIONS
4760  UA_UInt32 monitoredItemHandles;
4761  LIST_HEAD(ListOfUnacknowledgedNotifications, UA_Client_NotificationsAckNumber) pendingNotificationsAcks;
4762  LIST_HEAD(ListOfClientSubscriptionItems, UA_Client_Subscription) subscriptions;
4763 #endif
4764 };
4765 
4766 
4767 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/ua_types.c" ***********************************/
4768 
4769 /* This Source Code Form is subject to the terms of the Mozilla Public
4770 * License, v. 2.0. If a copy of the MPL was not distributed with this
4771 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
4772 
4773 
4774 
4775 /* Datatype Handling
4776  * -----------------
4777  * This file contains handling functions for the builtin types and functions
4778  * handling of structured types and arrays. These need type descriptions in a
4779  * UA_DataType structure. The UA_DataType structures as well as all non-builtin
4780  * datatypes are autogenerated. */
4781 
4782 /* Global definition of NULL type instances. These are always zeroed out, as
4783  * mandated by the C/C++ standard for global values with no initializer. */
4789 
4790 /* TODO: The standard-defined types are ordered. See if binary search is more
4791  * efficient. */
4792 const UA_DataType *
4793 UA_findDataType(const UA_NodeId *typeId) {
4794  for(size_t i = 0; i < UA_TYPES_COUNT; ++i) {
4795  if(UA_TYPES[i].typeId.identifier.numeric == typeId->identifier.numeric)
4796  return &UA_TYPES[i];
4797  }
4798  return NULL;
4799 }
4800 
4801 /***************************/
4802 /* Random Number Generator */
4803 /***************************/
4804 
4805 //static UA_THREAD_LOCAL pcg32_random_t UA_rng = PCG32_INITIALIZER;
4806 static pcg32_random_t UA_rng = PCG32_INITIALIZER;
4807 
4808 void
4810  pcg32_srandom_r(&UA_rng, seed, (uint64_t)UA_DateTime_now());
4811 }
4812 
4813 UA_UInt32
4815  return (UA_UInt32)pcg32_random_r(&UA_rng);
4816 }
4817 
4818 /*****************/
4819 /* Builtin Types */
4820 /*****************/
4821 
4822 static void deleteMembers_noInit(void *p, const UA_DataType *type);
4823 static UA_StatusCode copy_noInit(const void *src, void *dst, const UA_DataType *type);
4824 
4825 UA_String
4826 UA_String_fromChars(char const src[]) {
4827  UA_String str = UA_STRING_NULL;
4828  size_t length = strlen(src);
4829  if(length > 0) {
4830  str.data = (UA_Byte*)UA_malloc(length);
4831  if(!str.data)
4832  return str;
4833  } else {
4835  }
4836  memcpy(str.data, src, length);
4837  str.length = length;
4838  return str;
4839 }
4840 
4841 UA_Boolean
4842 UA_String_equal(const UA_String *s1, const UA_String *s2) {
4843  if(s1->length != s2->length)
4844  return false;
4845  UA_Int32 is = memcmp((char const*)s1->data,
4846  (char const*)s2->data, s1->length);
4847  return (is == 0) ? true : false;
4848 }
4849 
4850 static void
4851 String_deleteMembers(UA_String *s, const UA_DataType *_) {
4852  UA_free((void*)((uintptr_t)s->data & ~(uintptr_t)UA_EMPTY_ARRAY_SENTINEL));
4853 }
4854 
4855 /* DateTime */
4858  /* Calculating the the milli-, micro- and nanoseconds */
4859  UA_DateTimeStruct dateTimeStruct;
4860  dateTimeStruct.nanoSec = (UA_UInt16)((t % 10) * 100);
4861  dateTimeStruct.microSec = (UA_UInt16)((t % 10000) / 10);
4862  dateTimeStruct.milliSec = (UA_UInt16)((t % 10000000) / 10000);
4863 
4864  /* Calculating the unix time with #include <time.h> */
4865  time_t secSinceUnixEpoch =
4866  (time_t)((t - UA_DATETIME_UNIX_EPOCH) / UA_SEC_TO_DATETIME);
4867  struct tm ts;
4868  memset(&ts, 0, sizeof(struct tm));
4869  __secs_to_tm(secSinceUnixEpoch, &ts);
4870  dateTimeStruct.sec = (UA_UInt16)ts.tm_sec;
4871  dateTimeStruct.min = (UA_UInt16)ts.tm_min;
4872  dateTimeStruct.hour = (UA_UInt16)ts.tm_hour;
4873  dateTimeStruct.day = (UA_UInt16)ts.tm_mday;
4874  dateTimeStruct.month = (UA_UInt16)(ts.tm_mon + 1);
4875  dateTimeStruct.year = (UA_UInt16)(ts.tm_year + 1900);
4876  return dateTimeStruct;
4877 }
4878 
4879 static void
4880 printNumber(UA_UInt16 n, UA_Byte *pos, size_t digits) {
4881  for(size_t i = digits; i > 0; --i) {
4882  pos[i-1] = (UA_Byte)((n % 10) + '0');
4883  n = n / 10;
4884  }
4885 }
4886 
4887 UA_String
4889  UA_String str = UA_STRING_NULL;
4890  // length of the string is 31 (plus \0 at the end)
4891  if(!(str.data = (UA_Byte*)UA_malloc(32)))
4892  return str;
4893  str.length = 31;
4895  printNumber(tSt.month, str.data, 2);
4896  str.data[2] = '/';
4897  printNumber(tSt.day, &str.data[3], 2);
4898  str.data[5] = '/';
4899  printNumber(tSt.year, &str.data[6], 4);
4900  str.data[10] = ' ';
4901  printNumber(tSt.hour, &str.data[11], 2);
4902  str.data[13] = ':';
4903  printNumber(tSt.min, &str.data[14], 2);
4904  str.data[16] = ':';
4905  printNumber(tSt.sec, &str.data[17], 2);
4906  str.data[19] = '.';
4907  printNumber(tSt.milliSec, &str.data[20], 3);
4908  str.data[23] = '.';
4909  printNumber(tSt.microSec, &str.data[24], 3);
4910  str.data[27] = '.';
4911  printNumber(tSt.nanoSec, &str.data[28], 3);
4912  return str;
4913 }
4914 
4915 /* Guid */
4916 UA_Boolean
4917 UA_Guid_equal(const UA_Guid *g1, const UA_Guid *g2) {
4918  if(memcmp(g1, g2, sizeof(UA_Guid)) == 0)
4919  return true;
4920  return false;
4921 }
4922 
4923 UA_Guid
4925  UA_Guid result;
4926  result.data1 = (UA_UInt32)pcg32_random_r(&UA_rng);
4927  UA_UInt32 r = (UA_UInt32)pcg32_random_r(&UA_rng);
4928  result.data2 = (UA_UInt16) r;
4929  result.data3 = (UA_UInt16) (r >> 16);
4930  r = (UA_UInt32)pcg32_random_r(&UA_rng);
4931  result.data4[0] = (UA_Byte)r;
4932  result.data4[1] = (UA_Byte)(r >> 4);
4933  result.data4[2] = (UA_Byte)(r >> 8);
4934  result.data4[3] = (UA_Byte)(r >> 12);
4935  r = (UA_UInt32)pcg32_random_r(&UA_rng);
4936  result.data4[4] = (UA_Byte)r;
4937  result.data4[5] = (UA_Byte)(r >> 4);
4938  result.data4[6] = (UA_Byte)(r >> 8);
4939  result.data4[7] = (UA_Byte)(r >> 12);
4940  return result;
4941 }
4942 
4943 /* ByteString */
4946  UA_ByteString_init(bs);
4947  if(length == 0)
4948  return UA_STATUSCODE_GOOD;
4949  if(!(bs->data = (UA_Byte*)UA_malloc(length)))
4951  bs->length = length;
4952  return UA_STATUSCODE_GOOD;
4953 }
4954 
4955 /* NodeId */
4956 static void
4957 NodeId_deleteMembers(UA_NodeId *p, const UA_DataType *_) {
4958  switch(p->identifierType) {
4959  case UA_NODEIDTYPE_STRING:
4961  String_deleteMembers(&p->identifier.string, NULL);
4962  break;
4963  default: break;
4964  }
4965 }
4966 
4967 static UA_StatusCode
4968 NodeId_copy(UA_NodeId const *src, UA_NodeId *dst, const UA_DataType *_) {
4970  switch(src->identifierType) {
4971  case UA_NODEIDTYPE_NUMERIC:
4972  *dst = *src;
4973  return UA_STATUSCODE_GOOD;
4974  case UA_NODEIDTYPE_STRING:
4975  retval |= UA_String_copy(&src->identifier.string,
4976  &dst->identifier.string);
4977  break;
4978  case UA_NODEIDTYPE_GUID:
4979  retval |= UA_Guid_copy(&src->identifier.guid, &dst->identifier.guid);
4980  break;
4982  retval |= UA_ByteString_copy(&src->identifier.byteString,
4983  &dst->identifier.byteString);
4984  break;
4985  default:
4987  }
4988  dst->namespaceIndex = src->namespaceIndex;
4989  dst->identifierType = src->identifierType;
4990  return retval;
4991 }
4992 
4993 UA_Boolean
4995  if(p->namespaceIndex != 0)
4996  return false;
4997  switch(p->identifierType) {
4998  case UA_NODEIDTYPE_NUMERIC:
4999  return (p->identifier.numeric == 0);
5000  case UA_NODEIDTYPE_GUID:
5001  return (p->identifier.guid.data1 == 0 &&
5002  p->identifier.guid.data2 == 0 &&
5003  p->identifier.guid.data3 == 0 &&
5004  p->identifier.guid.data4[0] == 0 &&
5005  p->identifier.guid.data4[1] == 0 &&
5006  p->identifier.guid.data4[2] == 0 &&
5007  p->identifier.guid.data4[3] == 0 &&
5008  p->identifier.guid.data4[4] == 0 &&
5009  p->identifier.guid.data4[5] == 0 &&
5010  p->identifier.guid.data4[6] == 0 &&
5011  p->identifier.guid.data4[7] == 0);
5012  default:
5013  break;
5014  }
5015  return (p->identifier.string.length == 0);
5016 }
5017 
5018 UA_Boolean
5019 UA_NodeId_equal(const UA_NodeId *n1, const UA_NodeId *n2) {
5020  if(n1->namespaceIndex != n2->namespaceIndex ||
5021  n1->identifierType!=n2->identifierType)
5022  return false;
5023  switch(n1->identifierType) {
5024  case UA_NODEIDTYPE_NUMERIC:
5025  if(n1->identifier.numeric == n2->identifier.numeric)
5026  return true;
5027  else
5028  return false;
5029  case UA_NODEIDTYPE_STRING:
5030  return UA_String_equal(&n1->identifier.string,
5031  &n2->identifier.string);
5032  case UA_NODEIDTYPE_GUID:
5033  return UA_Guid_equal(&n1->identifier.guid,
5034  &n2->identifier.guid);
5036  return UA_ByteString_equal(&n1->identifier.byteString,
5037  &n2->identifier.byteString);
5038  }
5039  return false;
5040 }
5041 
5042 /* FNV non-cryptographic hash function. See
5043  * https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function */
5044 #define FNV_PRIME_32 16777619
5045 static UA_UInt32
5046 fnv32(UA_UInt32 fnv, const UA_Byte *buf, size_t size) {
5047  for(size_t i = 0; i < size; ++i) {
5048  fnv = fnv ^ (buf[i]);
5049  fnv = fnv * FNV_PRIME_32;
5050  }
5051  return fnv;
5052 }
5053 
5054 UA_UInt32
5056  switch(n->identifierType) {
5057  case UA_NODEIDTYPE_NUMERIC:
5058  default:
5059  return (UA_UInt32)(n->namespaceIndex + (n->identifier.numeric * 2654435761)); /* Knuth's multiplicative hashing */
5060  case UA_NODEIDTYPE_STRING:
5062  return fnv32(n->namespaceIndex, n->identifier.string.data, n->identifier.string.length);
5063  case UA_NODEIDTYPE_GUID:
5064  return fnv32(n->namespaceIndex, (const UA_Byte*)&n->identifier.guid, sizeof(UA_Guid));
5065  }
5066 }
5067 
5068 /* ExpandedNodeId */
5069 static void
5070 ExpandedNodeId_deleteMembers(UA_ExpandedNodeId *p, const UA_DataType *_) {
5071  NodeId_deleteMembers(&p->nodeId, _);
5072  String_deleteMembers(&p->namespaceUri, NULL);
5073 }
5074 
5075 static UA_StatusCode
5076 ExpandedNodeId_copy(UA_ExpandedNodeId const *src, UA_ExpandedNodeId *dst,
5077  const UA_DataType *_) {
5078  UA_StatusCode retval = NodeId_copy(&src->nodeId, &dst->nodeId, NULL);
5079  retval |= UA_String_copy(&src->namespaceUri, &dst->namespaceUri);
5080  dst->serverIndex = src->serverIndex;
5081  return retval;
5082 }
5083 
5084 /* ExtensionObject */
5085 static void
5086 ExtensionObject_deleteMembers(UA_ExtensionObject *p, const UA_DataType *_) {
5087  switch(p->encoding) {
5091  NodeId_deleteMembers(&p->content.encoded.typeId, NULL);
5092  String_deleteMembers(&p->content.encoded.body, NULL);
5093  break;
5095  if(p->content.decoded.data)
5096  UA_delete(p->content.decoded.data, p->content.decoded.type);
5097  break;
5098  default:
5099  break;
5100  }
5101 }
5102 
5103 static UA_StatusCode
5104 ExtensionObject_copy(UA_ExtensionObject const *src, UA_ExtensionObject *dst,
5105  const UA_DataType *_) {
5107  switch(src->encoding) {
5111  dst->encoding = src->encoding;
5112  retval = NodeId_copy(&src->content.encoded.typeId,
5113  &dst->content.encoded.typeId, NULL);
5114  retval |= UA_ByteString_copy(&src->content.encoded.body,
5115  &dst->content.encoded.body);
5116  break;
5119  if(!src->content.decoded.type || !src->content.decoded.data)
5122  dst->content.decoded.type = src->content.decoded.type;
5123  retval = UA_Array_copy(src->content.decoded.data, 1,
5124  &dst->content.decoded.data, src->content.decoded.type);
5125  break;
5126  default:
5127  break;
5128  }
5129  return retval;
5130 }
5131 
5132 /* Variant */
5133 static void
5134 Variant_deletemembers(UA_Variant *p, const UA_DataType *_) {
5135  if(p->storageType != UA_VARIANT_DATA)
5136  return;
5137  if(p->type && p->data > UA_EMPTY_ARRAY_SENTINEL) {
5138  if(p->arrayLength == 0)
5139  p->arrayLength = 1;
5140  UA_Array_delete(p->data, p->arrayLength, p->type);
5141  }
5144 }
5145 
5146 static UA_StatusCode
5147 Variant_copy(UA_Variant const *src, UA_Variant *dst, const UA_DataType *_) {
5148  size_t length = src->arrayLength;
5149  if(UA_Variant_isScalar(src))
5150  length = 1;
5151  UA_StatusCode retval = UA_Array_copy(src->data, length,
5152  &dst->data, src->type);
5153  if(retval != UA_STATUSCODE_GOOD)
5154  return retval;
5155  dst->arrayLength = src->arrayLength;
5156  dst->type = src->type;
5157  if(src->arrayDimensions) {
5159  (void**)&dst->arrayDimensions, &UA_TYPES[UA_TYPES_INT32]);
5160  if(retval != UA_STATUSCODE_GOOD)
5161  return retval;
5163  }
5164  return UA_STATUSCODE_GOOD;
5165 }
5166 
5167 void
5169  const UA_DataType *type) {
5170  UA_Variant_init(v);
5171  v->type = type;
5172  v->arrayLength = 0;
5173  v->data = p;
5174 }
5175 
5178  const UA_DataType *type) {
5179  void *n = UA_malloc(type->memSize);
5180  if(!n)
5182  UA_StatusCode retval = UA_copy(p, n, type);
5183  if(retval != UA_STATUSCODE_GOOD) {
5184  UA_free(n);
5185  //cppcheck-suppress memleak
5186  return retval;
5187  }
5188  UA_Variant_setScalar(v, n, type);
5189  //cppcheck-suppress memleak
5190  return UA_STATUSCODE_GOOD;
5191 }
5192 
5194  size_t arraySize, const UA_DataType *type) {
5195  UA_Variant_init(v);
5196  v->data = array;
5197  v->arrayLength = arraySize;
5198  v->type = type;
5199 }
5200 
5202 UA_Variant_setArrayCopy(UA_Variant *v, const void *array,
5203  size_t arraySize, const UA_DataType *type) {
5204  UA_Variant_init(v);
5205  UA_StatusCode retval = UA_Array_copy(array, arraySize, &v->data, type);
5206  if(retval != UA_STATUSCODE_GOOD)
5207  return retval;
5208  v->arrayLength = arraySize;
5209  v->type = type;
5210  return UA_STATUSCODE_GOOD;
5211 }
5212 
5213 /* Test if a range is compatible with a variant. If yes, the following values
5214  * are set:
5215  * - total: how many elements are in the range
5216  * - block: how big is each contiguous block of elements in the variant that
5217  * maps into the range
5218  * - stride: how many elements are between the blocks (beginning to beginning)
5219  * - first: where does the first block begin */
5220 static UA_StatusCode
5221 computeStrides(const UA_Variant *v, const UA_NumericRange range,
5222  size_t *total, size_t *block, size_t *stride, size_t *first) {
5223  /* Test for max array size */
5224 #if(MAX_SIZE > 0xffffffff) /* 64bit only */
5225  if(v->arrayLength > UA_UINT32_MAX)
5227 #endif
5228 
5229  /* Test the integrity of the source variant dimensions, make dimensions
5230  * vector of one dimension if none defined */
5231  UA_UInt32 arrayLength = (UA_UInt32)v->arrayLength;
5232  const UA_UInt32 *dims = &arrayLength;
5233  size_t dims_count = 1;
5234  if(v->arrayDimensionsSize > 0) {
5235  size_t elements = 1;
5236  dims_count = v->arrayDimensionsSize;
5237  dims = (UA_UInt32*)v->arrayDimensions;
5238  for(size_t i = 0; i < dims_count; ++i)
5239  elements *= dims[i];
5240  if(elements != v->arrayLength)
5242  }
5243  UA_assert(dims_count > 0);
5244 
5245  /* Test the integrity of the range and compute the max index used for every
5246  * dimension. The standard says in Part 4, Section 7.22:
5247  *
5248  * When reading a value, the indexes may not specify a range that is within
5249  * the bounds of the array. The Server shall return a partial result if some
5250  * elements exist within the range. */
5251  size_t count = 1;
5252  UA_UInt32 *realmax = UA_alloca(sizeof(UA_UInt32) * dims_count);
5253  if(range.dimensionsSize != dims_count)
5255  for(size_t i = 0; i < dims_count; ++i) {
5256  if(range.dimensions[i].min > range.dimensions[i].max)
5258  if(range.dimensions[i].min >= dims[i])
5260 
5261  if(range.dimensions[i].max < dims[i])
5262  realmax[i] = range.dimensions[i].max;
5263  else
5264  realmax[i] = dims[i] - 1;
5265 
5266  count *= (realmax[i] - range.dimensions[i].min) + 1;
5267  }
5268 
5269  *total = count;
5270 
5271  /* Compute the stride length and the position of the first element */
5272  *block = count; /* Assume the range describes the entire array. */
5273  *stride = v->arrayLength; /* So it can be copied as a contiguous block. */
5274  *first = 0;
5275  size_t running_dimssize = 1;
5276  UA_Boolean found_contiguous = false;
5277  for(size_t k = dims_count; k > 0;) {
5278  --k;
5279  size_t dimrange = 1 + realmax[k] - range.dimensions[k].min;
5280  if(!found_contiguous && dimrange != dims[k]) {
5281  /* Found the maximum block that can be copied contiguously */
5282  found_contiguous = true;
5283  *block = running_dimssize * dimrange;
5284  *stride = running_dimssize * dims[k];
5285  }
5286  *first += running_dimssize * range.dimensions[k].min;
5287  running_dimssize *= dims[k];
5288  }
5289  return UA_STATUSCODE_GOOD;
5290 }
5291 
5292 /* Is the type string-like? */
5293 static UA_Boolean
5294 isStringLike(const UA_DataType *type) {
5295  if(type->membersSize == 1 && type->members[0].isArray &&
5296  type->members[0].namespaceZero &&
5298  return true;
5299  return false;
5300 }
5301 
5302 /* Returns the part of the string that lies within the rangedimension */
5303 static UA_StatusCode
5304 copySubString(const UA_String *src, UA_String *dst,
5305  const UA_NumericRangeDimension *dim) {
5306  if(dim->min > dim->max)
5308  if(dim->min >= src->length)
5310 
5311  size_t length;
5312  if(dim->max < src->length)
5313  length = dim->max - dim->min + 1;
5314  else
5315  length = src->length - dim->min;
5316 
5317  UA_StatusCode retval = UA_ByteString_allocBuffer(dst, length);
5318  if(retval != UA_STATUSCODE_GOOD)
5319  return retval;
5320 
5321  memcpy(dst->data, &src->data[dim->min], length);
5322  return UA_STATUSCODE_GOOD;
5323 }
5324 
5327  const UA_NumericRange range) {
5328  UA_Boolean isScalar = UA_Variant_isScalar(src);
5329  UA_Boolean stringLike = isStringLike(src->type);
5330  UA_Variant arraySrc;
5331 
5332  /* Extract the range for copying at this level. The remaining range is dealt
5333  * with in the "scalar" type that may define an array by itself (string,
5334  * variant, ...). */
5335  UA_NumericRange thisrange, nextrange;
5336  UA_NumericRangeDimension scalarThisDimension = {0,0}; /* a single entry */
5337  if(isScalar) {
5338  /* Replace scalar src with array of length 1 */
5339  arraySrc = *src;
5340  arraySrc.arrayLength = 1;
5341  src = &arraySrc;
5342  /* Deal with all range dimensions within the scalar */
5343  thisrange.dimensions = &scalarThisDimension;
5344  thisrange.dimensionsSize = 1;
5345  nextrange = range;
5346  } else {
5347  /* Deal with as many range dimensions as possible right now */
5348  size_t dims = src->arrayDimensionsSize;
5349  if(dims == 0)
5350  dims = 1;
5351  if(dims > range.dimensionsSize)
5353  thisrange = range;
5354  thisrange.dimensionsSize = dims;
5355  nextrange.dimensions = &range.dimensions[dims];
5356  nextrange.dimensionsSize = range.dimensionsSize - dims;
5357  }
5358 
5359  /* Compute the strides */
5360  size_t count, block, stride, first;
5361  UA_StatusCode retval = computeStrides(src, thisrange, &count,
5362  &block, &stride, &first);
5363  if(retval != UA_STATUSCODE_GOOD)
5364  return retval;
5365 
5366  /* Allocate the array */
5367  UA_Variant_init(dst);
5368  dst->data = UA_Array_new(count, src->type);
5369  if(!dst->data)
5371 
5372  /* Copy the range */
5373  size_t block_count = count / block;
5374  size_t elem_size = src->type->memSize;
5375  uintptr_t nextdst = (uintptr_t)dst->data;
5376  uintptr_t nextsrc = (uintptr_t)src->data + (elem_size * first);
5377  if(nextrange.dimensionsSize == 0) {
5378  /* no nextrange */
5379  if(src->type->fixedSize) {
5380  for(size_t i = 0; i < block_count; ++i) {
5381  memcpy((void*)nextdst, (void*)nextsrc, elem_size * block);
5382  nextdst += block * elem_size;
5383  nextsrc += stride * elem_size;
5384  }
5385  } else {
5386  for(size_t i = 0; i < block_count; ++i) {
5387  for(size_t j = 0; j < block; ++j) {
5388  retval = UA_copy((const void*)nextsrc,
5389  (void*)nextdst, src->type);
5390  nextdst += elem_size;
5391  nextsrc += elem_size;
5392  }
5393  nextsrc += (stride - block) * elem_size;
5394  }
5395  }
5396  } else {
5397  /* nextrange can only be used for variants and stringlike with remaining
5398  * range of dimension 1 */
5399  if(src->type != &UA_TYPES[UA_TYPES_VARIANT]) {
5400  if(!stringLike)
5402  if(nextrange.dimensionsSize != 1)
5404  }
5405 
5406  /* Copy the content */
5407  for(size_t i = 0; i < block_count; ++i) {
5408  for(size_t j = 0; j < block && retval == UA_STATUSCODE_GOOD; ++j) {
5409  if(stringLike)
5410  retval = copySubString((const UA_String*)nextsrc,
5411  (UA_String*)nextdst,
5412  nextrange.dimensions);
5413  else
5414  retval = UA_Variant_copyRange((const UA_Variant*)nextsrc,
5415  (UA_Variant*)nextdst,
5416  nextrange);
5417  nextdst += elem_size;
5418  nextsrc += elem_size;
5419  }
5420  nextsrc += (stride - block) * elem_size;
5421  }
5422  }
5423 
5424  /* Clean up if copying failed */
5425  if(retval != UA_STATUSCODE_GOOD) {
5426  UA_Array_delete(dst->data, count, src->type);
5427  dst->data = NULL;
5428  return retval;
5429  }
5430 
5431  /* Done if scalar */
5432  dst->type = src->type;
5433  if(isScalar)
5434  return retval;
5435 
5436  /* Copy array dimensions */
5437  dst->arrayLength = count;
5438  if(src->arrayDimensionsSize > 0) {
5439  dst->arrayDimensions =
5441  if(!dst->arrayDimensions) {
5442  Variant_deletemembers(dst, NULL);
5444  }
5445  dst->arrayDimensionsSize = thisrange.dimensionsSize;
5446  for(size_t k = 0; k < thisrange.dimensionsSize; ++k)
5447  dst->arrayDimensions[k] =
5448  thisrange.dimensions[k].max - thisrange.dimensions[k].min + 1;
5449  }
5450  return UA_STATUSCODE_GOOD;
5451 }
5452 
5453 /* TODO: Allow ranges to reach inside a scalars that are array-like, e.g.
5454  * variant and strings. This is already possible for reading... */
5455 static UA_StatusCode
5456 Variant_setRange(UA_Variant *v, void *array, size_t arraySize,
5457  const UA_NumericRange range, UA_Boolean copy) {
5458  /* Compute the strides */
5459  size_t count, block, stride, first;
5460  UA_StatusCode retval = computeStrides(v, range, &count,
5461  &block, &stride, &first);
5462  if(retval != UA_STATUSCODE_GOOD)
5463  return retval;
5464  if(count != arraySize)
5466 
5467  /* Move/copy the elements */
5468  size_t block_count = count / block;
5469  size_t elem_size = v->type->memSize;
5470  uintptr_t nextdst = (uintptr_t)v->data + (first * elem_size);
5471  uintptr_t nextsrc = (uintptr_t)array;
5472  if(v->type->fixedSize || !copy) {
5473  for(size_t i = 0; i < block_count; ++i) {
5474  memcpy((void*)nextdst, (void*)nextsrc, elem_size * block);
5475  nextsrc += block * elem_size;
5476  nextdst += stride * elem_size;
5477  }
5478  } else {
5479  for(size_t i = 0; i < block_count; ++i) {
5480  for(size_t j = 0; j < block; ++j) {
5481  deleteMembers_noInit((void*)nextdst, v->type);
5482  retval |= UA_copy((void*)nextsrc, (void*)nextdst, v->type);
5483  nextdst += elem_size;
5484  nextsrc += elem_size;
5485  }
5486  nextdst += (stride - block) * elem_size;
5487  }
5488  }
5489 
5490  /* If members were moved, initialize original array to prevent reuse */
5491  if(!copy && !v->type->fixedSize)
5492  memset(array, 0, sizeof(elem_size)*arraySize);
5493 
5494  return retval;
5495 }
5496 
5499  size_t arraySize, const UA_NumericRange range) {
5500  return Variant_setRange(v, array, arraySize, range, false);
5501 }
5502 
5504 UA_Variant_setRangeCopy(UA_Variant *v, const void *array,
5505  size_t arraySize, const UA_NumericRange range) {
5506  return Variant_setRange(v, (void*)(uintptr_t)array,
5507  arraySize, range, true);
5508 }
5509 
5510 /* LocalizedText */
5511 static void
5512 LocalizedText_deleteMembers(UA_LocalizedText *p, const UA_DataType *_) {
5513  String_deleteMembers(&p->locale, NULL);
5514  String_deleteMembers(&p->text, NULL);
5515 }
5516 
5517 static UA_StatusCode
5518 LocalizedText_copy(UA_LocalizedText const *src, UA_LocalizedText *dst,
5519  const UA_DataType *_) {
5520  UA_StatusCode retval = UA_String_copy(&src->locale, &dst->locale);
5521  retval |= UA_String_copy(&src->text, &dst->text);
5522  return retval;
5523 }
5524 
5525 /* DataValue */
5526 static void
5527 DataValue_deleteMembers(UA_DataValue *p, const UA_DataType *_) {
5528  Variant_deletemembers(&p->value, NULL);
5529 }
5530 
5531 static UA_StatusCode
5532 DataValue_copy(UA_DataValue const *src, UA_DataValue *dst,
5533  const UA_DataType *_) {
5534  memcpy(dst, src, sizeof(UA_DataValue));
5535  UA_Variant_init(&dst->value);
5536  UA_StatusCode retval = Variant_copy(&src->value, &dst->value, NULL);
5537  if(retval != UA_STATUSCODE_GOOD)
5538  DataValue_deleteMembers(dst, NULL);
5539  return retval;
5540 }
5541 
5542 /* DiagnosticInfo */
5543 static void
5544 DiagnosticInfo_deleteMembers(UA_DiagnosticInfo *p, const UA_DataType *_) {
5545  String_deleteMembers(&p->additionalInfo, NULL);
5547  DiagnosticInfo_deleteMembers(p->innerDiagnosticInfo, NULL);
5549  }
5550 }
5551 
5552 static UA_StatusCode
5553 DiagnosticInfo_copy(UA_DiagnosticInfo const *src, UA_DiagnosticInfo *dst,
5554  const UA_DataType *_) {
5555  memcpy(dst, src, sizeof(UA_DiagnosticInfo));
5556  UA_String_init(&dst->additionalInfo);
5557  dst->innerDiagnosticInfo = NULL;
5559  if(src->hasAdditionalInfo)
5560  retval = UA_String_copy(&src->additionalInfo, &dst->additionalInfo);
5561  if(src->hasInnerDiagnosticInfo && src->innerDiagnosticInfo) {
5563  if(dst->innerDiagnosticInfo) {
5564  retval |= DiagnosticInfo_copy(src->innerDiagnosticInfo,
5565  dst->innerDiagnosticInfo, NULL);
5566  dst->hasInnerDiagnosticInfo = true;
5567  } else {
5568  dst->hasInnerDiagnosticInfo = false;
5569  retval |= UA_STATUSCODE_BADOUTOFMEMORY;
5570  }
5571  }
5572  return retval;
5573 }
5574 
5575 /********************/
5576 /* Structured Types */
5577 /********************/
5578 
5579 void *
5580 UA_new(const UA_DataType *type) {
5581  void *p = UA_calloc(1, type->memSize);
5582  return p;
5583 }
5584 
5585 static UA_StatusCode
5586 copyByte(const UA_Byte *src, UA_Byte *dst, const UA_DataType *_) {
5587  *dst = *src;
5588  return UA_STATUSCODE_GOOD;
5589 }
5590 
5591 static UA_StatusCode
5592 copy2Byte(const UA_UInt16 *src, UA_UInt16 *dst, const UA_DataType *_) {
5593  *dst = *src;
5594  return UA_STATUSCODE_GOOD;
5595 }
5596 
5597 static UA_StatusCode
5598 copy4Byte(const UA_UInt32 *src, UA_UInt32 *dst, const UA_DataType *_) {
5599  *dst = *src;
5600  return UA_STATUSCODE_GOOD;
5601 }
5602 
5603 static UA_StatusCode
5604 copy8Byte(const UA_UInt64 *src, UA_UInt64 *dst, const UA_DataType *_) {
5605  *dst = *src;
5606  return UA_STATUSCODE_GOOD;
5607 }
5608 
5609 static UA_StatusCode
5610 copyGuid(const UA_Guid *src, UA_Guid *dst, const UA_DataType *_) {
5611  *dst = *src;
5612  return UA_STATUSCODE_GOOD;
5613 }
5614 
5615 typedef UA_StatusCode
5616 (*UA_copySignature)(const void *src, void *dst, const UA_DataType *type);
5617 
5618 static const UA_copySignature copyJumpTable[UA_BUILTIN_TYPES_COUNT + 1] = {
5619  (UA_copySignature)copyByte, // Boolean
5620  (UA_copySignature)copyByte, // SByte
5621  (UA_copySignature)copyByte, // Byte
5622  (UA_copySignature)copy2Byte, // Int16
5623  (UA_copySignature)copy2Byte, // UInt16
5624  (UA_copySignature)copy4Byte, // Int32
5625  (UA_copySignature)copy4Byte, // UInt32
5626  (UA_copySignature)copy8Byte, // Int64
5627  (UA_copySignature)copy8Byte, // UInt64
5628  (UA_copySignature)copy4Byte, // Float
5629  (UA_copySignature)copy8Byte, // Double
5630  (UA_copySignature)copy_noInit, // String
5631  (UA_copySignature)copy8Byte, // DateTime
5632  (UA_copySignature)copyGuid, // Guid
5633  (UA_copySignature)copy_noInit, // ByteString
5634  (UA_copySignature)copy_noInit, // XmlElement
5635  (UA_copySignature)NodeId_copy,
5636  (UA_copySignature)ExpandedNodeId_copy,
5637  (UA_copySignature)copy4Byte, // StatusCode
5638  (UA_copySignature)copy_noInit, // QualifiedName
5639  (UA_copySignature)LocalizedText_copy, // LocalizedText
5640  (UA_copySignature)ExtensionObject_copy,
5641  (UA_copySignature)DataValue_copy,
5642  (UA_copySignature)Variant_copy,
5643  (UA_copySignature)DiagnosticInfo_copy,
5644  (UA_copySignature)copy_noInit // all others
5645 };
5646 
5647 static UA_StatusCode
5648 copy_noInit(const void *src, void *dst, const UA_DataType *type) {
5650  uintptr_t ptrs = (uintptr_t)src;
5651  uintptr_t ptrd = (uintptr_t)dst;
5652  UA_Byte membersSize = type->membersSize;
5653  for(size_t i = 0; i < membersSize; ++i) {
5654  const UA_DataTypeMember *m= &type->members[i];
5655  const UA_DataType *typelists[2] = { UA_TYPES, &type[-type->typeIndex] };
5656  const UA_DataType *mt = &typelists[!m->namespaceZero][m->memberTypeIndex];
5657  if(!m->isArray) {
5658  ptrs += m->padding;
5659  ptrd += m->padding;
5660  size_t fi = mt->builtin ? mt->typeIndex : UA_BUILTIN_TYPES_COUNT;
5661  retval |= copyJumpTable[fi]((const void*)ptrs, (void*)ptrd, mt);
5662  ptrs += mt->memSize;
5663  ptrd += mt->memSize;
5664  } else {
5665  ptrs += m->padding;
5666  ptrd += m->padding;
5667  size_t *dst_size = (size_t*)ptrd;
5668  const size_t size = *((const size_t*)ptrs);
5669  ptrs += sizeof(size_t);
5670  ptrd += sizeof(size_t);
5671  retval |= UA_Array_copy(*(void* const*)ptrs, size, (void**)ptrd, mt);
5672  if(retval == UA_STATUSCODE_GOOD)
5673  *dst_size = size;
5674  else
5675  *dst_size = 0;
5676  ptrs += sizeof(void*);
5677  ptrd += sizeof(void*);
5678  }
5679  }
5680  return retval;
5681 }
5682 
5684 UA_copy(const void *src, void *dst, const UA_DataType *type) {
5685  memset(dst, 0, type->memSize); /* init */
5686  UA_StatusCode retval = copy_noInit(src, dst, type);
5687  if(retval != UA_STATUSCODE_GOOD)
5688  UA_deleteMembers(dst, type);
5689  return retval;
5690 }
5691 
5692 static void nopDeleteMembers(void *p, const UA_DataType *type) { }
5693 
5694 typedef void (*UA_deleteMembersSignature)(void *p, const UA_DataType *type);
5695 
5696 static const
5697 UA_deleteMembersSignature deleteMembersJumpTable[UA_BUILTIN_TYPES_COUNT + 1] = {
5698  (UA_deleteMembersSignature)nopDeleteMembers, // Boolean
5699  (UA_deleteMembersSignature)nopDeleteMembers, // SByte
5700  (UA_deleteMembersSignature)nopDeleteMembers, // Byte
5701  (UA_deleteMembersSignature)nopDeleteMembers, // Int16
5702  (UA_deleteMembersSignature)nopDeleteMembers, // UInt16
5703  (UA_deleteMembersSignature)nopDeleteMembers, // Int32
5704  (UA_deleteMembersSignature)nopDeleteMembers, // UInt32
5705  (UA_deleteMembersSignature)nopDeleteMembers, // Int64
5706  (UA_deleteMembersSignature)nopDeleteMembers, // UInt64
5707  (UA_deleteMembersSignature)nopDeleteMembers, // Float
5708  (UA_deleteMembersSignature)nopDeleteMembers, // Double
5709  (UA_deleteMembersSignature)String_deleteMembers, // String
5710  (UA_deleteMembersSignature)nopDeleteMembers, // DateTime
5711  (UA_deleteMembersSignature)nopDeleteMembers, // Guid
5712  (UA_deleteMembersSignature)String_deleteMembers, // ByteString
5713  (UA_deleteMembersSignature)String_deleteMembers, // XmlElement
5714  (UA_deleteMembersSignature)NodeId_deleteMembers,
5715  (UA_deleteMembersSignature)ExpandedNodeId_deleteMembers, // ExpandedNodeId
5716  (UA_deleteMembersSignature)nopDeleteMembers, // StatusCode
5717  (UA_deleteMembersSignature)deleteMembers_noInit, // QualifiedName
5718  (UA_deleteMembersSignature)LocalizedText_deleteMembers, // LocalizedText
5719  (UA_deleteMembersSignature)ExtensionObject_deleteMembers,
5720  (UA_deleteMembersSignature)DataValue_deleteMembers,
5721  (UA_deleteMembersSignature)Variant_deletemembers,
5722  (UA_deleteMembersSignature)DiagnosticInfo_deleteMembers,
5723  (UA_deleteMembersSignature)deleteMembers_noInit,
5724 };
5725 
5726 static void
5727 deleteMembers_noInit(void *p, const UA_DataType *type) {
5728  uintptr_t ptr = (uintptr_t)p;
5729  UA_Byte membersSize = type->membersSize;
5730  for(size_t i = 0; i < membersSize; ++i) {
5731  const UA_DataTypeMember *m= &type->members[i];
5732  const UA_DataType *typelists[2] = { UA_TYPES, &type[-type->typeIndex] };
5733  const UA_DataType *mt = &typelists[!m->namespaceZero][m->memberTypeIndex];
5734  if(!m->isArray) {
5735  ptr += m->padding;
5736  size_t fi = mt->builtin ? mt->typeIndex : UA_BUILTIN_TYPES_COUNT;
5737  deleteMembersJumpTable[fi]((void*)ptr, mt);
5738  ptr += mt->memSize;
5739  } else {
5740  ptr += m->padding;
5741  size_t length = *(size_t*)ptr;
5742  ptr += sizeof(size_t);
5743  UA_Array_delete(*(void**)ptr, length, mt);
5744  ptr += sizeof(void*);
5745  }
5746  }
5747 }
5748 
5749 void
5750 UA_deleteMembers(void *p, const UA_DataType *type) {
5751  deleteMembers_noInit(p, type);
5752  memset(p, 0, type->memSize); /* init */
5753 }
5754 
5755 void
5756 UA_delete(void *p, const UA_DataType *type) {
5757  deleteMembers_noInit(p, type);
5758  UA_free(p);
5759 }
5760 
5761 /******************/
5762 /* Array Handling */
5763 /******************/
5764 
5765 void *
5766 UA_Array_new(size_t size, const UA_DataType *type) {
5767  if(size == 0)
5768  return UA_EMPTY_ARRAY_SENTINEL;
5769  return UA_calloc(size, type->memSize);
5770 }
5771 
5773 UA_Array_copy(const void *src, size_t size,
5774  void **dst, const UA_DataType *type) {
5775  if(size == 0) {
5776  if(src == NULL)
5777  *dst = NULL;
5778  else
5780  return UA_STATUSCODE_GOOD;
5781  }
5782 
5783  if(!type)
5785 
5786  /* calloc, so we don't have to check retval in every iteration of copying */
5787  *dst = UA_calloc(size, type->memSize);
5788  if(!*dst)
5790 
5791  if(type->fixedSize) {
5792  memcpy(*dst, src, type->memSize * size);
5793  return UA_STATUSCODE_GOOD;
5794  }
5795 
5796  uintptr_t ptrs = (uintptr_t)src;
5797  uintptr_t ptrd = (uintptr_t)*dst;
5799  for(size_t i = 0; i < size; ++i) {
5800  retval |= UA_copy((void*)ptrs, (void*)ptrd, type);
5801  ptrs += type->memSize;
5802  ptrd += type->memSize;
5803  }
5804  if(retval != UA_STATUSCODE_GOOD) {
5805  UA_Array_delete(*dst, size, type);
5806  *dst = NULL;
5807  }
5808  return retval;
5809 }
5810 
5811 void
5812 UA_Array_delete(void *p, size_t size, const UA_DataType *type) {
5813  if(!type->fixedSize) {
5814  uintptr_t ptr = (uintptr_t)p;
5815  for(size_t i = 0; i < size; ++i) {
5816  UA_deleteMembers((void*)ptr, type);
5817  ptr += type->memSize;
5818  }
5819  }
5820  UA_free((void*)((uintptr_t)p & ~(uintptr_t)UA_EMPTY_ARRAY_SENTINEL));
5821 }
5822 
5823 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/ua_types_encoding_binary.c" ***********************************/
5824 
5825 /* This Source Code Form is subject to the terms of the Mozilla Public
5826  * License, v. 2.0. If a copy of the MPL was not distributed with this
5827  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5828 
5829 
5830 /* Type Encoding
5831  * -------------
5832  * This file contains encoding functions for the builtin data types and generic
5833  * functions that operate on all types and arrays. This requires the type
5834  * description from a UA_DataType structure. Note that some internal (static)
5835  * deocidng functions may abort and leave the type in an inconsistent state. But
5836  * this is always handled in UA_decodeBinary, where the error is caught and the
5837  * type cleaned up.
5838  *
5839  * Breaking a message into chunks is integrated with the encoding. When the end
5840  * of a buffer is reached, a callback is executed that sends the current buffer
5841  * as a chunk and exchanges the encoding buffer "underneath" the ongoing
5842  * encoding. This enables fast sending of large messages as spurious copying is
5843  * avoided. */
5844 
5845 #if defined(__clang__)
5846 # pragma GCC diagnostic push
5847 # pragma GCC diagnostic warning "-W#warnings"
5848 #endif
5849 
5850 #ifndef UA_BINARY_OVERLAYABLE_INTEGER
5851 # warning Integer endianness could not be detected to be little endian. Use slow generic encoding.
5852 #endif
5853 
5854 /* There is no robust way to detect float endianness in clang. This warning can be removed
5855  * if the target is known to be little endian with floats in the IEEE 754 format. */
5856 #ifndef UA_BINARY_OVERLAYABLE_FLOAT
5857 # warning Float endianness could not be detected to be little endian in the IEEE 754 format. Use slow generic encoding.
5858 #endif
5859 
5860 #if defined(__clang__)
5861 # pragma GCC diagnostic pop
5862 #endif
5863 
5864 /* Jumptables for de-/encoding and computing the buffer length. The methods in
5865  * the decoding jumptable do not all clean up their allocated memory when an
5866  * error occurs. So a final _deleteMembers needs to be called before returning
5867  * to the user. */
5868 typedef status (*UA_encodeBinarySignature)(const void *UA_RESTRICT src, const UA_DataType *type);
5870 
5873 
5874 typedef size_t (*UA_calcSizeBinarySignature)(const void *UA_RESTRICT p, const UA_DataType *contenttype);
5876 
5877 /* Pointers to the current position and the last position in the buffer */
5878 static UA_THREAD_LOCAL u8 *g_pos;
5879 static UA_THREAD_LOCAL const u8 *g_end;
5880 static UA_THREAD_LOCAL UA_ByteString g_buf;
5881 
5882 /* In UA_encodeBinaryInternal, we store a pointer to the last "good" position in
5883  * the buffer. When encoding reaches the end of the buffer, send out a chunk
5884  * until that position, replace the buffer and retry encoding after the last
5885  * "checkpoint". The status code UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED is used
5886  * exclusively to indicate that the end of the buffer was reached.
5887  *
5888  * In order to prevent restoring to an old buffer position (where the buffer was
5889  * exchanged within a call from UA_encodeBinaryInternal and is no longer
5890  * valied), no methods must return UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED after
5891  * calling exchangeBuffer(). This needs to be ensured for the following methods:
5892  *
5893  * UA_encodeBinaryInternal
5894  * Array_encodeBinary
5895  * NodeId_encodeBinary
5896  * ExpandedNodeId_encodeBinary
5897  * LocalizedText_encodeBinary
5898  * ExtensionObject_encodeBinary
5899  * Variant_encodeBinary
5900  * DataValue_encodeBinary
5901  * DiagnosticInfo_encodeBinary */
5902 
5903 /* Thread-local buffers used for exchanging the buffer for chunking */
5904 static UA_THREAD_LOCAL UA_exchangeEncodeBuffer g_exchangeBufferCallback;
5905 static UA_THREAD_LOCAL void *g_exchangeBufferCallbackHandle;
5906 
5907 /* Send the current chunk and replace the buffer */
5908 static status
5909 exchangeBuffer(void) {
5910  if(!g_exchangeBufferCallback)
5912 
5913  /* Store context variables since exchangeBuffer might call UA_encode itself */
5914  UA_exchangeEncodeBuffer store_exchangeBufferCallback = g_exchangeBufferCallback;
5915  void *store_exchangeBufferCallbackHandle = g_exchangeBufferCallbackHandle;
5916  UA_ByteString buf = g_buf;
5917  size_t offset = (uintptr_t)(g_pos - g_buf.data);
5918 
5919  status ret = g_exchangeBufferCallback(g_exchangeBufferCallbackHandle, &buf, offset);
5920 
5921  /* Restore context variables */
5922  g_exchangeBufferCallback = store_exchangeBufferCallback;
5923  g_exchangeBufferCallbackHandle = store_exchangeBufferCallbackHandle;
5924  g_buf = buf;
5925  g_pos = buf.data;
5926  g_end = &buf.data[buf.length];
5927  return ret;
5928 }
5929 
5930 /*****************/
5931 /* Integer Types */
5932 /*****************/
5933 
5934 #if !UA_BINARY_OVERLAYABLE_INTEGER
5935 
5936 /* These en/decoding functions are only used when the architecture isn't little-endian. */
5937 static void
5938 UA_encode16(const u16 v, u8 buf[2]) {
5939  buf[0] = (u8)v;
5940  buf[1] = (u8)(v >> 8);
5941 }
5942 
5943 static void
5944 UA_decode16(const u8 buf[2], u16 *v) {
5945  *v = (u16)((u16)buf[0] + (((u16)buf[1]) << 8));
5946 }
5947 
5948 static void
5949 UA_encode32(const u32 v, u8 buf[4]) {
5950  buf[0] = (u8)v;
5951  buf[1] = (u8)(v >> 8);
5952  buf[2] = (u8)(v >> 16);
5953  buf[3] = (u8)(v >> 24);
5954 }
5955 
5956 static void
5957 UA_decode32(const u8 buf[4], u32 *v) {
5958  *v = (u32)((u32)buf[0] +
5959  (((u32)buf[1]) << 8) +
5960  (((u32)buf[2]) << 16) +
5961  (((u32)buf[3]) << 24));
5962 }
5963 
5964 static void
5965 UA_encode64(const u64 v, u8 buf[8]) {
5966  buf[0] = (u8)v;
5967  buf[1] = (u8)(v >> 8);
5968  buf[2] = (u8)(v >> 16);
5969  buf[3] = (u8)(v >> 24);
5970  buf[4] = (u8)(v >> 32);
5971  buf[5] = (u8)(v >> 40);
5972  buf[6] = (u8)(v >> 48);
5973  buf[7] = (u8)(v >> 56);
5974 }
5975 
5976 static void
5977 UA_decode64(const u8 buf[8], u64 *v) {
5978  *v = (u64)((u64)buf[0] +
5979  (((u64)buf[1]) << 8) +
5980  (((u64)buf[2]) << 16) +
5981  (((u64)buf[3]) << 24) +
5982  (((u64)buf[4]) << 32) +
5983  (((u64)buf[5]) << 40) +
5984  (((u64)buf[6]) << 48) +
5985  (((u64)buf[7]) << 56));
5986 }
5987 
5988 #endif /* !UA_BINARY_OVERLAYABLE_INTEGER */
5989 
5990 /* Boolean */
5991 static status
5992 Boolean_encodeBinary(const bool *src, const UA_DataType *_) {
5993  if(g_pos + sizeof(bool) > g_end)
5995  *g_pos = *(const u8*)src;
5996  ++g_pos;
5997  return UA_STATUSCODE_GOOD;
5998 }
5999 
6000 static status
6001 Boolean_decodeBinary(bool *dst, const UA_DataType *_) {
6002  if(g_pos + sizeof(bool) > g_end)
6004  *dst = (*g_pos > 0) ? true : false;
6005  ++g_pos;
6006  return UA_STATUSCODE_GOOD;
6007 }
6008 
6009 /* Byte */
6010 static status
6011 Byte_encodeBinary(const u8 *src, const UA_DataType *_) {
6012  if(g_pos + sizeof(u8) > g_end)
6014  *g_pos = *(const u8*)src;
6015  ++g_pos;
6016  return UA_STATUSCODE_GOOD;
6017 }
6018 
6019 static status
6020 Byte_decodeBinary(u8 *dst, const UA_DataType *_) {
6021  if(g_pos + sizeof(u8) > g_end)
6023  *dst = *g_pos;
6024  ++g_pos;
6025  return UA_STATUSCODE_GOOD;
6026 }
6027 
6028 /* UInt16 */
6029 static status
6030 UInt16_encodeBinary(u16 const *src, const UA_DataType *_) {
6031  if(g_pos + sizeof(u16) > g_end)
6033 #if UA_BINARY_OVERLAYABLE_INTEGER
6034  memcpy(g_pos, src, sizeof(u16));
6035 #else
6036  UA_encode16(*src, g_pos);
6037 #endif
6038  g_pos += 2;
6039  return UA_STATUSCODE_GOOD;
6040 }
6041 
6042 static status
6043 UInt16_decodeBinary(u16 *dst, const UA_DataType *_) {
6044  if(g_pos + sizeof(u16) > g_end)
6046 #if UA_BINARY_OVERLAYABLE_INTEGER
6047  memcpy(dst, g_pos, sizeof(u16));
6048 #else
6049  UA_decode16(g_pos, dst);
6050 #endif
6051  g_pos += 2;
6052  return UA_STATUSCODE_GOOD;
6053 }
6054 
6055 /* UInt32 */
6056 static status
6057 UInt32_encodeBinary(u32 const *src, const UA_DataType *_) {
6058  if(g_pos + sizeof(u32) > g_end)
6060 #if UA_BINARY_OVERLAYABLE_INTEGER
6061  memcpy(g_pos, src, sizeof(u32));
6062 #else
6063  UA_encode32(*src, g_pos);
6064 #endif
6065  g_pos += 4;
6066  return UA_STATUSCODE_GOOD;
6067 }
6068 
6069 static UA_INLINE status
6070 Int32_encodeBinary(i32 const *src) {
6071  return UInt32_encodeBinary((const u32*)src, NULL);
6072 }
6073 
6074 static status
6075 UInt32_decodeBinary(u32 *dst, const UA_DataType *_) {
6076  if(g_pos + sizeof(u32) > g_end)
6078 #if UA_BINARY_OVERLAYABLE_INTEGER
6079  memcpy(dst, g_pos, sizeof(u32));
6080 #else
6081  UA_decode32(g_pos, dst);
6082 #endif
6083  g_pos += 4;
6084  return UA_STATUSCODE_GOOD;
6085 }
6086 
6087 static UA_INLINE status
6088 Int32_decodeBinary(i32 *dst) {
6089  return UInt32_decodeBinary((u32*)dst, NULL);
6090 }
6091 
6092 static UA_INLINE status
6093 StatusCode_decodeBinary(status *dst) {
6094  return UInt32_decodeBinary((u32*)dst, NULL);
6095 }
6096 
6097 /* UInt64 */
6098 static status
6099 UInt64_encodeBinary(u64 const *src, const UA_DataType *_) {
6100  if(g_pos + sizeof(u64) > g_end)
6102 #if UA_BINARY_OVERLAYABLE_INTEGER
6103  memcpy(g_pos, src, sizeof(u64));
6104 #else
6105  UA_encode64(*src, g_pos);
6106 #endif
6107  g_pos += 8;
6108  return UA_STATUSCODE_GOOD;
6109 }
6110 
6111 static status
6112 UInt64_decodeBinary(u64 *dst, const UA_DataType *_) {
6113  if(g_pos + sizeof(u64) > g_end)
6115 #if UA_BINARY_OVERLAYABLE_INTEGER
6116  memcpy(dst, g_pos, sizeof(u64));
6117 #else
6118  UA_decode64(g_pos, dst);
6119 #endif
6120  g_pos += 8;
6121  return UA_STATUSCODE_GOOD;
6122 }
6123 
6124 static UA_INLINE status
6125 DateTime_decodeBinary(UA_DateTime *dst) {
6126  return UInt64_decodeBinary((u64*)dst, NULL);
6127 }
6128 
6129 /************************/
6130 /* Floating Point Types */
6131 /************************/
6132 
6133 #if UA_BINARY_OVERLAYABLE_FLOAT
6134 # define Float_encodeBinary UInt32_encodeBinary
6135 # define Float_decodeBinary UInt32_decodeBinary
6136 # define Double_encodeBinary UInt64_encodeBinary
6137 # define Double_decodeBinary UInt64_decodeBinary
6138 #else
6139 
6140 #include <math.h>
6141 
6142 /* Handling of IEEE754 floating point values was taken from Beej's Guide to
6143  * Network Programming (http://beej.us/guide/bgnet/) and enhanced to cover the
6144  * edge cases +/-0, +/-inf and nan. */
6145 static uint64_t
6146 pack754(long double f, unsigned bits, unsigned expbits) {
6147  unsigned significandbits = bits - expbits - 1;
6148  long double fnorm;
6149  long long sign;
6150  if (f < 0) { sign = 1; fnorm = -f; }
6151  else { sign = 0; fnorm = f; }
6152  int shift = 0;
6153  while(fnorm >= 2.0) { fnorm /= 2.0; ++shift; }
6154  while(fnorm < 1.0) { fnorm *= 2.0; --shift; }
6155  fnorm = fnorm - 1.0;
6156  long long significand = (long long)(fnorm * ((float)(1LL<<significandbits) + 0.5f));
6157  long long exponent = shift + ((1<<(expbits-1)) - 1);
6158  return (uint64_t)((sign<<(bits-1)) | (exponent<<(bits-expbits-1)) | significand);
6159 }
6160 
6161 static long double
6162 unpack754(uint64_t i, unsigned bits, unsigned expbits) {
6163  unsigned significandbits = bits - expbits - 1;
6164  long double result = (long double)(i&(uint64_t)((1LL<<significandbits)-1));
6165  result /= (1LL<<significandbits);
6166  result += 1.0f;
6167  unsigned bias = (unsigned)(1<<(expbits-1)) - 1;
6168  long long shift = (long long)((i>>significandbits) & (uint64_t)((1LL<<expbits)-1)) - bias;
6169  while(shift > 0) { result *= 2.0; --shift; }
6170  while(shift < 0) { result /= 2.0; ++shift; }
6171  result *= ((i>>(bits-1))&1)? -1.0: 1.0;
6172  return result;
6173 }
6174 
6175 /* Float */
6176 #define FLOAT_NAN 0xffc00000
6177 #define FLOAT_INF 0x7f800000
6178 #define FLOAT_NEG_INF 0xff800000
6179 #define FLOAT_NEG_ZERO 0x80000000
6180 
6181 static status
6182 Float_encodeBinary(UA_Float const *src, const UA_DataType *_) {
6183  UA_Float f = *src;
6184  u32 encoded;
6185  //cppcheck-suppress duplicateExpression
6186  if(f != f) encoded = FLOAT_NAN;
6187  else if(f == 0.0f) encoded = signbit(f) ? FLOAT_NEG_ZERO : 0;
6188  //cppcheck-suppress duplicateExpression
6189  else if(f/f != f/f) encoded = f > 0 ? FLOAT_INF : FLOAT_NEG_INF;
6190  else encoded = (u32)pack754(f, 32, 8);
6191  return UInt32_encodeBinary(&encoded, NULL);
6192 }
6193 
6194 static status
6195 Float_decodeBinary(UA_Float *dst, const UA_DataType *_) {
6196  u32 decoded;
6197  status ret = UInt32_decodeBinary(&decoded, NULL);
6198  if(ret != UA_STATUSCODE_GOOD)
6199  return ret;
6200  if(decoded == 0) *dst = 0.0f;
6201  else if(decoded == FLOAT_NEG_ZERO) *dst = -0.0f;
6202  else if(decoded == FLOAT_INF) *dst = INFINITY;
6203  else if(decoded == FLOAT_NEG_INF) *dst = -INFINITY;
6204  else if((decoded >= 0x7f800001 && decoded <= 0x7fffffff) ||
6205  (decoded >= 0xff800001 && decoded <= 0xffffffff)) *dst = NAN;
6206  else *dst = (UA_Float)unpack754(decoded, 32, 8);
6207  return UA_STATUSCODE_GOOD;
6208 }
6209 
6210 /* Double */
6211 #define DOUBLE_NAN 0xfff8000000000000L
6212 #define DOUBLE_INF 0x7ff0000000000000L
6213 #define DOUBLE_NEG_INF 0xfff0000000000000L
6214 #define DOUBLE_NEG_ZERO 0x8000000000000000L
6215 
6216 static status
6217 Double_encodeBinary(UA_Double const *src, const UA_DataType *_) {
6218  UA_Double d = *src;
6219  u64 encoded;
6220  //cppcheck-suppress duplicateExpression
6221  if(d != d) encoded = DOUBLE_NAN;
6222  else if(d == 0.0) encoded = signbit(d) ? DOUBLE_NEG_ZERO : 0;
6223  //cppcheck-suppress duplicateExpression
6224  else if(d/d != d/d) encoded = d > 0 ? DOUBLE_INF : DOUBLE_NEG_INF;
6225  else encoded = pack754(d, 64, 11);
6226  return UInt64_encodeBinary(&encoded, NULL);
6227 }
6228 
6229 static status
6230 Double_decodeBinary(UA_Double *dst, const UA_DataType *_) {
6231  u64 decoded;
6232  status ret = UInt64_decodeBinary(&decoded, NULL);
6233  if(ret != UA_STATUSCODE_GOOD)
6234  return ret;
6235  if(decoded == 0) *dst = 0.0;
6236  else if(decoded == DOUBLE_NEG_ZERO) *dst = -0.0;
6237  else if(decoded == DOUBLE_INF) *dst = INFINITY;
6238  else if(decoded == DOUBLE_NEG_INF) *dst = -INFINITY;
6239  //cppcheck-suppress redundantCondition
6240  else if((decoded >= 0x7ff0000000000001L && decoded <= 0x7fffffffffffffffL) ||
6241  (decoded >= 0xfff0000000000001L && decoded <= 0xffffffffffffffffL)) *dst = NAN;
6242  else *dst = (UA_Double)unpack754(decoded, 64, 11);
6243  return UA_STATUSCODE_GOOD;
6244 }
6245 
6246 #endif
6247 
6248 /* If encoding fails, exchange the buffer and try again. It is assumed that
6249  * encoding of numerical types never fails on a fresh buffer. */
6250 static status
6251 encodeNumericWithExchangeBuffer(const void *ptr,
6252  UA_encodeBinarySignature encodeFunc) {
6253  status ret = encodeFunc(ptr, NULL);
6255  ret = exchangeBuffer();
6256  if(ret != UA_STATUSCODE_GOOD)
6257  return ret;
6258  encodeFunc(ptr, NULL);
6259  }
6260  return UA_STATUSCODE_GOOD;
6261 }
6262 
6263 /* If the type is more complex, wrap encoding into the following method to
6264  * ensure that the buffer is exchanged with intermediate checkpoints. */
6265 static status
6266 UA_encodeBinaryInternal(const void *src, const UA_DataType *type);
6267 
6268 /******************/
6269 /* Array Handling */
6270 /******************/
6271 
6272 static status
6273 Array_encodeBinaryOverlayable(uintptr_t ptr, size_t length, size_t elementMemSize) {
6274  /* Store the number of already encoded elements */
6275  size_t finished = 0;
6276 
6277  /* Loop as long as more elements remain than fit into the chunk */
6278  while(g_end < g_pos + (elementMemSize * (length-finished))) {
6279  size_t possible = ((uintptr_t)g_end - (uintptr_t)g_pos) / (sizeof(u8) * elementMemSize);
6280  size_t possibleMem = possible * elementMemSize;
6281  memcpy(g_pos, (void*)ptr, possibleMem);
6282  g_pos += possibleMem;
6283  ptr += possibleMem;
6284  finished += possible;
6285  status ret = exchangeBuffer();
6286  if(ret != UA_STATUSCODE_GOOD)
6287  return ret;
6288  }
6289 
6290  /* Encode the remaining elements */
6291  memcpy(g_pos, (void*)ptr, elementMemSize * (length-finished));
6292  g_pos += elementMemSize * (length-finished);
6293  return UA_STATUSCODE_GOOD;
6294 }
6295 
6296 static status
6297 Array_encodeBinaryComplex(uintptr_t ptr, size_t length, const UA_DataType *type) {
6298  /* Get the encoding function for the data type. The jumptable at
6299  * UA_BUILTIN_TYPES_COUNT points to the generic UA_encodeBinary method */
6300  size_t encode_index = type->builtin ? type->typeIndex : UA_BUILTIN_TYPES_COUNT;
6301  UA_encodeBinarySignature encodeType = encodeBinaryJumpTable[encode_index];
6302 
6303  /* Encode every element */
6304  for(size_t i = 0; i < length; ++i) {
6305  u8 *oldpos = g_pos;
6306  status ret = encodeType((const void*)ptr, type);
6307  ptr += type->memSize;
6308  /* Encoding failed, switch to the next chunk when possible */
6309  if(ret != UA_STATUSCODE_GOOD) {
6311  g_pos = oldpos; /* Set buffer position to the end of the last encoded element */
6312  ret = exchangeBuffer();
6313  ptr -= type->memSize; /* Undo to retry encoding the ith element */
6314  --i;
6315  }
6317  if(ret != UA_STATUSCODE_GOOD)
6318  return ret; /* Unrecoverable fail */
6319  }
6320  }
6321  return UA_STATUSCODE_GOOD;
6322 }
6323 
6324 static status
6325 Array_encodeBinary(const void *src, size_t length, const UA_DataType *type) {
6326  /* Check and convert the array length to int32 */
6327  i32 signed_length = -1;
6328  if(length > UA_INT32_MAX)
6330  if(length > 0)
6331  signed_length = (i32)length;
6332  else if(src == UA_EMPTY_ARRAY_SENTINEL)
6333  signed_length = 0;
6334 
6335  /* Encode the array length */
6336  status ret = encodeNumericWithExchangeBuffer(&signed_length,
6337  (UA_encodeBinarySignature)UInt32_encodeBinary);
6338 
6339  /* Quit early? */
6340  if(ret != UA_STATUSCODE_GOOD || length == 0)
6341  return ret;
6342 
6343  /* Encode the content */
6344  if(!type->overlayable)
6345  return Array_encodeBinaryComplex((uintptr_t)src, length, type);
6346  return Array_encodeBinaryOverlayable((uintptr_t)src, length, type->memSize);
6347 }
6348 
6349 static status
6350 Array_decodeBinary(void *UA_RESTRICT *UA_RESTRICT dst,
6351  size_t *out_length, const UA_DataType *type) {
6352  /* Decode the length */
6353  i32 signed_length;
6354  status ret = Int32_decodeBinary(&signed_length);
6355  if(ret != UA_STATUSCODE_GOOD)
6356  return ret;
6357 
6358  /* Return early for empty arrays */
6359  if(signed_length <= 0) {
6360  *out_length = 0;
6361  if(signed_length < 0)
6362  *dst = NULL;
6363  else
6364  *dst = UA_EMPTY_ARRAY_SENTINEL;
6365  return UA_STATUSCODE_GOOD;
6366  }
6367 
6368  /* Filter out arrays that can obviously not be decoded, because the message
6369  * is too small for the array length. This prevents the allocation of very
6370  * long arrays for bogus messages.*/
6371  size_t length = (size_t)signed_length;
6372  if(g_pos + ((type->memSize * length) / 32) > g_end)
6374 
6375  /* Allocate memory */
6376  *dst = UA_calloc(length, type->memSize);
6377  if(!*dst)
6379 
6380  if(type->overlayable) {
6381  /* memcpy overlayable array */
6382  if(g_end < g_pos + (type->memSize * length)) {
6383  UA_free(*dst);
6384  *dst = NULL;
6386  }
6387  memcpy(*dst, g_pos, type->memSize * length);
6388  g_pos += type->memSize * length;
6389  } else {
6390  /* Decode array members */
6391  uintptr_t ptr = (uintptr_t)*dst;
6392  size_t decode_index = type->builtin ? type->typeIndex : UA_BUILTIN_TYPES_COUNT;
6393  for(size_t i = 0; i < length; ++i) {
6394  ret = decodeBinaryJumpTable[decode_index]((void*)ptr, type);
6395  if(ret != UA_STATUSCODE_GOOD) {
6396  // +1 because last element is also already initialized
6397  UA_Array_delete(*dst, i+1, type);
6398  *dst = NULL;
6399  return ret;
6400  }
6401  ptr += type->memSize;
6402  }
6403  }
6404  *out_length = length;
6405  return UA_STATUSCODE_GOOD;
6406 }
6407 
6408 /*****************/
6409 /* Builtin Types */
6410 /*****************/
6411 
6412 static status
6413 String_encodeBinary(UA_String const *src, const UA_DataType *_) {
6414  return Array_encodeBinary(src->data, src->length, &UA_TYPES[UA_TYPES_BYTE]);
6415 }
6416 
6417 static status
6418 String_decodeBinary(UA_String *dst, const UA_DataType *_) {
6419  return Array_decodeBinary((void**)&dst->data, &dst->length, &UA_TYPES[UA_TYPES_BYTE]);
6420 }
6421 
6422 static UA_INLINE status
6423 ByteString_encodeBinary(UA_ByteString const *src) {
6424  return String_encodeBinary((const UA_String*)src, NULL);
6425 }
6426 
6427 static UA_INLINE status
6428 ByteString_decodeBinary(UA_ByteString *dst) {
6429  return String_decodeBinary((UA_ByteString*)dst, NULL);
6430 }
6431 
6432 /* Guid */
6433 static status
6434 Guid_encodeBinary(UA_Guid const *src, const UA_DataType *_) {
6435  status ret = UInt32_encodeBinary(&src->data1, NULL);
6436  ret |= UInt16_encodeBinary(&src->data2, NULL);
6437  ret |= UInt16_encodeBinary(&src->data3, NULL);
6438  if(g_pos + (8*sizeof(u8)) > g_end)
6440  memcpy(g_pos, src->data4, 8*sizeof(u8));
6441  g_pos += 8;
6442  return ret;
6443 }
6444 
6445 static status
6446 Guid_decodeBinary(UA_Guid *dst, const UA_DataType *_) {
6447  status ret = UInt32_decodeBinary(&dst->data1, NULL);
6448  ret |= UInt16_decodeBinary(&dst->data2, NULL);
6449  ret |= UInt16_decodeBinary(&dst->data3, NULL);
6450  if(g_pos + (8*sizeof(u8)) > g_end)
6452  memcpy(dst->data4, g_pos, 8*sizeof(u8));
6453  g_pos += 8;
6454  return ret;
6455 }
6456 
6457 /* NodeId */
6458 #define UA_NODEIDTYPE_NUMERIC_TWOBYTE 0
6459 #define UA_NODEIDTYPE_NUMERIC_FOURBYTE 1
6460 #define UA_NODEIDTYPE_NUMERIC_COMPLETE 2
6461 
6462 #define UA_EXPANDEDNODEID_SERVERINDEX_FLAG 0x40
6463 #define UA_EXPANDEDNODEID_NAMESPACEURI_FLAG 0x80
6464 
6465 /* For ExpandedNodeId, we prefill the encoding mask. We can return
6466  * UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED before encoding the string, as the
6467  * buffer is not replaced. */
6468 static status
6469 NodeId_encodeBinaryWithEncodingMask(UA_NodeId const *src, u8 encoding) {
6470  status ret = UA_STATUSCODE_GOOD;
6471  switch(src->identifierType) {
6472  case UA_NODEIDTYPE_NUMERIC:
6474  encoding |= UA_NODEIDTYPE_NUMERIC_COMPLETE;
6475  ret |= Byte_encodeBinary(&encoding, NULL);
6476  ret |= UInt16_encodeBinary(&src->namespaceIndex, NULL);
6477  ret |= UInt32_encodeBinary(&src->identifier.numeric, NULL);
6478  } else if(src->identifier.numeric > UA_BYTE_MAX || src->namespaceIndex > 0) {
6479  encoding |= UA_NODEIDTYPE_NUMERIC_FOURBYTE;
6480  ret |= Byte_encodeBinary(&encoding, NULL);
6481  u8 nsindex = (u8)src->namespaceIndex;
6482  ret |= Byte_encodeBinary(&nsindex, NULL);
6483  u16 identifier16 = (u16)src->identifier.numeric;
6484  ret |= UInt16_encodeBinary(&identifier16, NULL);
6485  } else {
6486  encoding |= UA_NODEIDTYPE_NUMERIC_TWOBYTE;
6487  ret |= Byte_encodeBinary(&encoding, NULL);
6488  u8 identifier8 = (u8)src->identifier.numeric;
6489  ret |= Byte_encodeBinary(&identifier8, NULL);
6490  }
6491  break;
6492  case UA_NODEIDTYPE_STRING:
6493  encoding |= UA_NODEIDTYPE_STRING;
6494  ret |= Byte_encodeBinary(&encoding, NULL);
6495  ret |= UInt16_encodeBinary(&src->namespaceIndex, NULL);
6496  if(ret != UA_STATUSCODE_GOOD)
6497  return ret;
6498  ret = String_encodeBinary(&src->identifier.string, NULL);
6499  break;
6500  case UA_NODEIDTYPE_GUID:
6501  encoding |= UA_NODEIDTYPE_GUID;
6502  ret |= Byte_encodeBinary(&encoding, NULL);
6503  ret |= UInt16_encodeBinary(&src->namespaceIndex, NULL);
6504  ret |= Guid_encodeBinary(&src->identifier.guid, NULL);
6505  break;
6507  encoding |= UA_NODEIDTYPE_BYTESTRING;
6508  ret |= Byte_encodeBinary(&encoding, NULL);
6509  ret |= UInt16_encodeBinary(&src->namespaceIndex, NULL);
6510  if(ret != UA_STATUSCODE_GOOD)
6511  return ret;
6512  ret = ByteString_encodeBinary(&src->identifier.byteString);
6513  break;
6514  default:
6516  }
6517  return ret;
6518 }
6519 
6520 static status
6521 NodeId_encodeBinary(UA_NodeId const *src, const UA_DataType *_) {
6522  return NodeId_encodeBinaryWithEncodingMask(src, 0);
6523 }
6524 
6525 static status
6526 NodeId_decodeBinary(UA_NodeId *dst, const UA_DataType *_) {
6527  u8 dstByte = 0, encodingByte = 0;
6528  u16 dstUInt16 = 0;
6529 
6530  /* Decode the encoding bitfield */
6531  status ret = Byte_decodeBinary(&encodingByte, NULL);
6532  if(ret != UA_STATUSCODE_GOOD)
6533  return ret;
6534 
6535  /* Filter out the bits used only for ExpandedNodeIds */
6536  encodingByte &= (u8)~(UA_EXPANDEDNODEID_SERVERINDEX_FLAG |
6538 
6539  /* Decode the namespace and identifier */
6540  switch (encodingByte) {
6543  ret = Byte_decodeBinary(&dstByte, NULL);
6544  dst->identifier.numeric = dstByte;
6545  dst->namespaceIndex = 0;
6546  break;
6549  ret |= Byte_decodeBinary(&dstByte, NULL);
6550  dst->namespaceIndex = dstByte;
6551  ret |= UInt16_decodeBinary(&dstUInt16, NULL);
6552  dst->identifier.numeric = dstUInt16;
6553  break;
6556  ret |= UInt16_decodeBinary(&dst->namespaceIndex, NULL);
6557  ret |= UInt32_decodeBinary(&dst->identifier.numeric, NULL);
6558  break;
6559  case UA_NODEIDTYPE_STRING:
6561  ret |= UInt16_decodeBinary(&dst->namespaceIndex, NULL);
6562  ret |= String_decodeBinary(&dst->identifier.string, NULL);
6563  break;
6564  case UA_NODEIDTYPE_GUID:
6566  ret |= UInt16_decodeBinary(&dst->namespaceIndex, NULL);
6567  ret |= Guid_decodeBinary(&dst->identifier.guid, NULL);
6568  break;
6571  ret |= UInt16_decodeBinary(&dst->namespaceIndex, NULL);
6572  ret |= ByteString_decodeBinary(&dst->identifier.byteString);
6573  break;
6574  default:
6576  break;
6577  }
6578  return ret;
6579 }
6580 
6581 /* ExpandedNodeId */
6582 static status
6583 ExpandedNodeId_encodeBinary(UA_ExpandedNodeId const *src, const UA_DataType *_) {
6584  /* Set up the encoding mask */
6585  u8 encoding = 0;
6586  if((void*)src->namespaceUri.data > UA_EMPTY_ARRAY_SENTINEL)
6588  if(src->serverIndex > 0)
6590 
6591  /* Encode the NodeId */
6592  status ret = NodeId_encodeBinaryWithEncodingMask(&src->nodeId, encoding);
6593  if(ret != UA_STATUSCODE_GOOD)
6594  return ret;
6595 
6596  /* Encode the namespace. Do not return
6597  * UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED afterwards. */
6598  if((void*)src->namespaceUri.data > UA_EMPTY_ARRAY_SENTINEL) {
6599  ret = String_encodeBinary(&src->namespaceUri, NULL);
6601  if(ret != UA_STATUSCODE_GOOD)
6602  return ret;
6603  }
6604 
6605  /* Encode the serverIndex */
6606  if(src->serverIndex > 0)
6607  ret = encodeNumericWithExchangeBuffer(&src->serverIndex,
6608  (UA_encodeBinarySignature)UInt32_encodeBinary);
6610  return ret;
6611 }
6612 
6613 static status
6614 ExpandedNodeId_decodeBinary(UA_ExpandedNodeId *dst, const UA_DataType *_) {
6615  /* Decode the encoding mask */
6616  if(g_pos >= g_end)
6618  u8 encoding = *g_pos;
6619 
6620  /* Decode the NodeId */
6621  status ret = NodeId_decodeBinary(&dst->nodeId, NULL);
6622 
6623  /* Decode the NamespaceUri */
6624  if(encoding & UA_EXPANDEDNODEID_NAMESPACEURI_FLAG) {
6625  dst->nodeId.namespaceIndex = 0;
6626  ret |= String_decodeBinary(&dst->namespaceUri, NULL);
6627  }
6628 
6629  /* Decode the ServerIndex */
6630  if(encoding & UA_EXPANDEDNODEID_SERVERINDEX_FLAG)
6631  ret |= UInt32_decodeBinary(&dst->serverIndex, NULL);
6632  return ret;
6633 }
6634 
6635 /* LocalizedText */
6636 #define UA_LOCALIZEDTEXT_ENCODINGMASKTYPE_LOCALE 0x01
6637 #define UA_LOCALIZEDTEXT_ENCODINGMASKTYPE_TEXT 0x02
6638 
6639 static status
6640 LocalizedText_encodeBinary(UA_LocalizedText const *src, const UA_DataType *_) {
6641  /* Set up the encoding mask */
6642  u8 encoding = 0;
6643  if(src->locale.data)
6645  if(src->text.data)
6647 
6648  /* Encode the encoding byte */
6649  status ret = Byte_encodeBinary(&encoding, NULL);
6650  if(ret != UA_STATUSCODE_GOOD)
6651  return ret;
6652 
6653  /* Encode the strings */
6655  ret |= String_encodeBinary(&src->locale, NULL);
6657  ret |= String_encodeBinary(&src->text, NULL);
6659  return ret;
6660 }
6661 
6662 static status
6663 LocalizedText_decodeBinary(UA_LocalizedText *dst, const UA_DataType *_) {
6664  /* Decode the encoding mask */
6665  u8 encoding = 0;
6666  status ret = Byte_decodeBinary(&encoding, NULL);
6667 
6668  /* Decode the content */
6670  ret |= String_decodeBinary(&dst->locale, NULL);
6672  ret |= String_decodeBinary(&dst->text, NULL);
6673  return ret;
6674 }
6675 
6676 /* The binary encoding has a different nodeid from the data type. So it is not
6677  * possible to reuse UA_findDataType */
6678 static const UA_DataType *
6679 UA_findDataTypeByBinary(const UA_NodeId *typeId) {
6680  /* We only store a numeric identifier for the encoding nodeid of data types */
6681  if(typeId->identifierType != UA_NODEIDTYPE_NUMERIC)
6682  return NULL;
6683 
6684  /* Iterate over the array */
6685  for(size_t i = 0; i < UA_TYPES_COUNT; ++i) {
6686  if(UA_TYPES[i].binaryEncodingId == typeId->identifier.numeric &&
6688  return &UA_TYPES[i];
6689  }
6690  return NULL;
6691 }
6692 
6693 /* ExtensionObject */
6694 static status
6695 ExtensionObject_encodeBinary(UA_ExtensionObject const *src, const UA_DataType *_) {
6696  u8 encoding = src->encoding;
6697 
6698  /* No content or already encoded content. Do not return
6699  * UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED after encoding the NodeId. */
6700  if(encoding <= UA_EXTENSIONOBJECT_ENCODED_XML) {
6701  status ret = NodeId_encodeBinary(&src->content.encoded.typeId, NULL);
6702  if(ret != UA_STATUSCODE_GOOD)
6703  return ret;
6704  ret = encodeNumericWithExchangeBuffer(&encoding,
6705  (UA_encodeBinarySignature)Byte_encodeBinary);
6706  if(ret != UA_STATUSCODE_GOOD)
6707  return ret;
6708  switch (src->encoding) {
6710  break;
6713  ret = ByteString_encodeBinary(&src->content.encoded.body);
6714  break;
6715  default:
6717  }
6718  return ret;
6719  }
6720 
6721  /* Cannot encode with no data or no type description */
6722  if(!src->content.decoded.type || !src->content.decoded.data)
6724 
6725  /* Write the NodeId for the binary encoded type. The NodeId is always
6726  * numeric, so no buffer replacement is taking place. */
6727  UA_NodeId typeId = src->content.decoded.type->typeId;
6730  typeId.identifier.numeric = src->content.decoded.type->binaryEncodingId;
6731  status ret = NodeId_encodeBinary(&typeId, NULL);
6732 
6733  /* Write the encoding byte */
6735  ret |= Byte_encodeBinary(&encoding, NULL);
6736 
6737  /* Compute the content length */
6738  const UA_DataType *type = src->content.decoded.type;
6739  size_t len = UA_calcSizeBinary(src->content.decoded.data, type);
6740 
6741  /* Encode the content length */
6742  if(len > UA_INT32_MAX)
6744  i32 signed_len = (i32)len;
6745  ret |= Int32_encodeBinary(&signed_len);
6746 
6747  /* Return early upon failures (no buffer exchange until here) */
6748  if(ret != UA_STATUSCODE_GOOD)
6749  return ret;
6750 
6751  /* Encode the content */
6752  return UA_encodeBinaryInternal(src->content.decoded.data, type);
6753 }
6754 
6755 static status
6756 ExtensionObject_decodeBinaryContent(UA_ExtensionObject *dst, const UA_NodeId *typeId) {
6757  /* Lookup the datatype */
6758  const UA_DataType *type = UA_findDataTypeByBinary(typeId);
6759 
6760  /* Unknown type, just take the binary content */
6761  if(!type) {
6763  UA_NodeId_copy(typeId, &dst->content.encoded.typeId);
6764  return ByteString_decodeBinary(&dst->content.encoded.body);
6765  }
6766 
6767  /* Allocate memory */
6768  dst->content.decoded.data = UA_new(type);
6769  if(!dst->content.decoded.data)
6771 
6772  /* Jump over the length field (TODO: check if the decoded length matches) */
6773  g_pos += 4;
6774 
6775  /* Decode */
6777  dst->content.decoded.type = type;
6778  size_t decode_index = type->builtin ? type->typeIndex : UA_BUILTIN_TYPES_COUNT;
6779  return decodeBinaryJumpTable[decode_index](dst->content.decoded.data, type);
6780 }
6781 
6782 static status
6783 ExtensionObject_decodeBinary(UA_ExtensionObject *dst, const UA_DataType *_) {
6784  u8 encoding = 0;
6785  UA_NodeId binTypeId; /* Can contain a string nodeid. But no corresponding
6786  * type is then found in open62541. We only store
6787  * numerical nodeids of the binary encoding identifier.
6788  * The extenionobject will be decoded to contain a
6789  * binary blob. */
6790  UA_NodeId_init(&binTypeId);
6791  status ret = NodeId_decodeBinary(&binTypeId, NULL);
6792  ret |= Byte_decodeBinary(&encoding, NULL);
6793  if(ret != UA_STATUSCODE_GOOD) {
6794  UA_NodeId_deleteMembers(&binTypeId);
6795  return ret;
6796  }
6797 
6798  if(encoding == UA_EXTENSIONOBJECT_ENCODED_BYTESTRING) {
6799  ret = ExtensionObject_decodeBinaryContent(dst, &binTypeId);
6800  UA_NodeId_deleteMembers(&binTypeId);
6801  } else if(encoding == UA_EXTENSIONOBJECT_ENCODED_NOBODY) {
6802  dst->encoding = (UA_ExtensionObjectEncoding)encoding;
6803  dst->content.encoded.typeId = binTypeId; /* move to dst */
6804  dst->content.encoded.body = UA_BYTESTRING_NULL;
6805  } else if(encoding == UA_EXTENSIONOBJECT_ENCODED_XML) {
6806  dst->encoding = (UA_ExtensionObjectEncoding)encoding;
6807  dst->content.encoded.typeId = binTypeId; /* move to dst */
6808  ret = ByteString_decodeBinary(&dst->content.encoded.body);
6809  if(ret != UA_STATUSCODE_GOOD)
6810  UA_NodeId_deleteMembers(&dst->content.encoded.typeId);
6811  } else {
6812  UA_NodeId_deleteMembers(&binTypeId);
6814  }
6815 
6816  return ret;
6817 }
6818 
6819 /* Variant */
6820 
6821 /* Never returns UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED */
6822 static status
6823 Variant_encodeBinaryWrapExtensionObject(const UA_Variant *src, const bool isArray) {
6824  /* Default to 1 for a scalar. */
6825  size_t length = 1;
6826 
6827  /* Encode the array length if required */
6828  status ret = UA_STATUSCODE_GOOD;
6829  if(isArray) {
6830  if(src->arrayLength > UA_INT32_MAX)
6832  length = src->arrayLength;
6833  i32 encodedLength = (i32)src->arrayLength;
6834  ret = Int32_encodeBinary(&encodedLength);
6835  if(ret != UA_STATUSCODE_GOOD)
6836  return ret;
6837  }
6838 
6839  /* Set up the ExtensionObject */
6840  UA_ExtensionObject eo;
6841  UA_ExtensionObject_init(&eo);
6843  eo.content.decoded.type = src->type;
6844  const u16 memSize = src->type->memSize;
6845  uintptr_t ptr = (uintptr_t)src->data;
6846 
6847  /* Iterate over the array */
6848  for(size_t i = 0; i < length && ret == UA_STATUSCODE_GOOD; ++i) {
6849  eo.content.decoded.data = (void*)ptr;
6850  ret = UA_encodeBinaryInternal(&eo, &UA_TYPES[UA_TYPES_EXTENSIONOBJECT]);
6851  ptr += memSize;
6852  }
6853  return ret;
6854 }
6855 
6859  UA_VARIANT_ENCODINGMASKTYPE_ARRAY = (0x01 << 7) // bit 7
6860 };
6861 
6862 static status
6863 Variant_encodeBinary(const UA_Variant *src, const UA_DataType *_) {
6864  /* Quit early for the empty variant */
6865  u8 encoding = 0;
6866  if(!src->type)
6867  return Byte_encodeBinary(&encoding, NULL);
6868 
6869  /* Set the content type in the encoding mask */
6870  const bool isBuiltin = src->type->builtin;
6871  if(isBuiltin)
6872  encoding |= UA_VARIANT_ENCODINGMASKTYPE_TYPEID_MASK & (u8)(src->type->typeIndex + 1);
6873  else
6875 
6876  /* Set the array type in the encoding mask */
6877  const bool isArray = src->arrayLength > 0 || src->data <= UA_EMPTY_ARRAY_SENTINEL;
6878  const bool hasDimensions = isArray && src->arrayDimensionsSize > 0;
6879  if(isArray) {
6881  if(hasDimensions)
6883  }
6884 
6885  /* Encode the encoding byte */
6886  status ret = Byte_encodeBinary(&encoding, NULL);
6887  if(ret != UA_STATUSCODE_GOOD)
6888  return ret;
6889 
6890  /* Encode the content */
6891  if(!isBuiltin)
6892  ret = Variant_encodeBinaryWrapExtensionObject(src, isArray);
6893  else if(!isArray)
6894  ret = UA_encodeBinaryInternal(src->data, src->type);
6895  else
6896  ret = Array_encodeBinary(src->data, src->arrayLength, src->type);
6897 
6898  /* Encode the array dimensions */
6899  if(hasDimensions && ret == UA_STATUSCODE_GOOD)
6900  ret = Array_encodeBinary(src->arrayDimensions, src->arrayDimensionsSize,
6902  return ret;
6903 }
6904 
6905 static status
6906 Variant_decodeBinaryUnwrapExtensionObject(UA_Variant *dst) {
6907  /* Save the position in the ByteString. If unwrapping is not possible, start
6908  * from here to decode a normal ExtensionObject. */
6909  u8 *old_pos = g_pos;
6910 
6911  /* Decode the DataType */
6912  UA_NodeId typeId;
6913  UA_NodeId_init(&typeId);
6914  status ret = NodeId_decodeBinary(&typeId, NULL);
6915  if(ret != UA_STATUSCODE_GOOD)
6916  return ret;
6917 
6918  /* Decode the EncodingByte */
6919  u8 encoding;
6920  ret = Byte_decodeBinary(&encoding, NULL);
6921  if(ret != UA_STATUSCODE_GOOD) {
6922  UA_NodeId_deleteMembers(&typeId);
6923  return ret;
6924  }
6925 
6926  /* Search for the datatype. Default to ExtensionObject. */
6927  if(encoding == UA_EXTENSIONOBJECT_ENCODED_BYTESTRING &&
6928  (dst->type = UA_findDataTypeByBinary(&typeId)) != NULL) {
6929  /* Jump over the length field (TODO: check if length matches) */
6930  g_pos += 4;
6931  } else {
6932  /* Reset and decode as ExtensionObject */
6934  g_pos = old_pos;
6935  UA_NodeId_deleteMembers(&typeId);
6936  }
6937 
6938  /* Allocate memory */
6939  dst->data = UA_new(dst->type);
6940  if(!dst->data)
6942 
6943  /* Decode the content */
6944  size_t decode_index = dst->type->builtin ? dst->type->typeIndex : UA_BUILTIN_TYPES_COUNT;
6945  return decodeBinaryJumpTable[decode_index](dst->data, dst->type);
6946 }
6947 
6948 /* The resulting variant always has the storagetype UA_VARIANT_DATA. */
6949 static status
6950 Variant_decodeBinary(UA_Variant *dst, const UA_DataType *_) {
6951  /* Decode the encoding byte */
6952  u8 encodingByte;
6953  status ret = Byte_decodeBinary(&encodingByte, NULL);
6954  if(ret != UA_STATUSCODE_GOOD)
6955  return ret;
6956 
6957  /* Return early for an empty variant (was already _inited) */
6958  if(encodingByte == 0)
6959  return UA_STATUSCODE_GOOD;
6960 
6961  /* Does the variant contain an array? */
6962  const bool isArray = (encodingByte & UA_VARIANT_ENCODINGMASKTYPE_ARRAY) > 0;
6963 
6964  /* Get the datatype of the content. The type must be a builtin data type.
6965  * All not-builtin types are wrapped in an ExtensionObject.
6966  * The content can not be a variant again, otherwise we may run into a stack overflow problem.
6967  * See: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=4233 */
6968  size_t typeIndex = (size_t)((encodingByte & UA_VARIANT_ENCODINGMASKTYPE_TYPEID_MASK) - 1);
6969  if(typeIndex > UA_TYPES_DIAGNOSTICINFO || typeIndex == UA_TYPES_VARIANT)
6971  dst->type = &UA_TYPES[typeIndex];
6972 
6973  /* Decode the content */
6974  if(isArray) {
6975  ret = Array_decodeBinary(&dst->data, &dst->arrayLength, dst->type);
6976  } else if(typeIndex != UA_TYPES_EXTENSIONOBJECT) {
6977  dst->data = UA_new(dst->type);
6978  if(!dst->data)
6980  ret = decodeBinaryJumpTable[typeIndex](dst->data, dst->type);
6981  } else {
6982  ret = Variant_decodeBinaryUnwrapExtensionObject(dst);
6983  }
6984 
6985  /* Decode array dimensions */
6986  if(isArray && (encodingByte & UA_VARIANT_ENCODINGMASKTYPE_DIMENSIONS) > 0)
6987  ret |= Array_decodeBinary((void**)&dst->arrayDimensions,
6989  return ret;
6990 }
6991 
6992 /* DataValue */
6993 static status
6994 DataValue_encodeBinary(UA_DataValue const *src, const UA_DataType *_) {
6995  /* Set up the encoding mask */
6996  u8 encodingMask = (u8)
6997  (((u8)src->hasValue) |
6998  ((u8)src->hasStatus << 1) |
6999  ((u8)src->hasSourceTimestamp << 2) |
7000  ((u8)src->hasServerTimestamp << 3) |
7001  ((u8)src->hasSourcePicoseconds << 4) |
7002  ((u8)src->hasServerPicoseconds << 5));
7003 
7004  /* Encode the encoding byte */
7005  status ret = Byte_encodeBinary(&encodingMask, NULL);
7006  if(ret != UA_STATUSCODE_GOOD)
7007  return ret;
7008 
7009  /* Encode the variant. Afterwards, do not return
7010  * UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED, as the buffer might have been
7011  * exchanged during encoding of the variant. */
7012  if(src->hasValue) {
7013  ret = Variant_encodeBinary(&src->value, NULL);
7014  if(ret != UA_STATUSCODE_GOOD)
7015  return ret;
7016  }
7017 
7018  if(src->hasStatus)
7019  ret |= encodeNumericWithExchangeBuffer(&src->status,
7020  (UA_encodeBinarySignature)UInt32_encodeBinary);
7021  if(src->hasSourceTimestamp)
7022  ret |= encodeNumericWithExchangeBuffer(&src->sourceTimestamp,
7023  (UA_encodeBinarySignature)UInt64_encodeBinary);
7024  if(src->hasSourcePicoseconds)
7025  ret |= encodeNumericWithExchangeBuffer(&src->sourcePicoseconds,
7026  (UA_encodeBinarySignature)UInt16_encodeBinary);
7027  if(src->hasServerTimestamp)
7028  ret |= encodeNumericWithExchangeBuffer(&src->serverTimestamp,
7029  (UA_encodeBinarySignature)UInt64_encodeBinary);
7030  if(src->hasServerPicoseconds)
7031  ret |= encodeNumericWithExchangeBuffer(&src->serverPicoseconds,
7032  (UA_encodeBinarySignature)UInt16_encodeBinary);
7034  return ret;
7035 }
7036 
7037 #define MAX_PICO_SECONDS 9999
7038 
7039 static status
7040 DataValue_decodeBinary(UA_DataValue *dst, const UA_DataType *_) {
7041  /* Decode the encoding mask */
7042  u8 encodingMask;
7043  status ret = Byte_decodeBinary(&encodingMask, NULL);
7044  if(ret != UA_STATUSCODE_GOOD)
7045  return ret;
7046 
7047  /* Decode the content */
7048  if(encodingMask & 0x01) {
7049  dst->hasValue = true;
7050  ret |= Variant_decodeBinary(&dst->value, NULL);
7051  }
7052  if(encodingMask & 0x02) {
7053  dst->hasStatus = true;
7054  ret |= StatusCode_decodeBinary(&dst->status);
7055  }
7056  if(encodingMask & 0x04) {
7057  dst->hasSourceTimestamp = true;
7058  ret |= DateTime_decodeBinary(&dst->sourceTimestamp);
7059  }
7060  if(encodingMask & 0x10) {
7061  dst->hasSourcePicoseconds = true;
7062  ret |= UInt16_decodeBinary(&dst->sourcePicoseconds, NULL);
7065  }
7066  if(encodingMask & 0x08) {
7067  dst->hasServerTimestamp = true;
7068  ret |= DateTime_decodeBinary(&dst->serverTimestamp);
7069  }
7070  if(encodingMask & 0x20) {
7071  dst->hasServerPicoseconds = true;
7072  ret |= UInt16_decodeBinary(&dst->serverPicoseconds, NULL);
7075  }
7076  return ret;
7077 }
7078 
7079 /* DiagnosticInfo */
7080 static status
7081 DiagnosticInfo_encodeBinary(const UA_DiagnosticInfo *src, const UA_DataType *_) {
7082  /* Set up the encoding mask */
7083  u8 encodingMask = (u8)
7084  ((u8)src->hasSymbolicId | ((u8)src->hasNamespaceUri << 1) |
7085  ((u8)src->hasLocalizedText << 2) | ((u8)src->hasLocale << 3) |
7086  ((u8)src->hasAdditionalInfo << 4) | ((u8)src->hasInnerDiagnosticInfo << 5));
7087 
7088  /* Encode the numeric content */
7089  status ret = Byte_encodeBinary(&encodingMask, NULL);
7090  if(src->hasSymbolicId)
7091  ret |= Int32_encodeBinary(&src->symbolicId);
7092  if(src->hasNamespaceUri)
7093  ret |= Int32_encodeBinary(&src->namespaceUri);
7094  if(src->hasLocalizedText)
7095  ret |= Int32_encodeBinary(&src->localizedText);
7096  if(src->hasLocale)
7097  ret |= Int32_encodeBinary(&src->locale);
7098  if(ret != UA_STATUSCODE_GOOD)
7099  return ret;
7100 
7101  /* Encode the additional info */
7102  if(src->hasAdditionalInfo) {
7103  ret = String_encodeBinary(&src->additionalInfo, NULL);
7104  if(ret != UA_STATUSCODE_GOOD)
7105  return ret;
7106  }
7107 
7108  /* From here on, do not return UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED, as
7109  * the buffer might have been exchanged during encoding of the string. */
7110 
7111  /* Encode the inner status code */
7112  if(src->hasInnerStatusCode) {
7113  ret = encodeNumericWithExchangeBuffer(&src->innerStatusCode,
7114  (UA_encodeBinarySignature)UInt32_encodeBinary);
7116  if(ret != UA_STATUSCODE_GOOD)
7117  return ret;
7118  }
7119 
7120  /* Encode the inner diagnostic info */
7121  if(src->hasInnerDiagnosticInfo)
7122  ret = UA_encodeBinaryInternal(src->innerDiagnosticInfo,
7124 
7126  return ret;
7127 }
7128 
7129 static status
7130 DiagnosticInfo_decodeBinary(UA_DiagnosticInfo *dst, const UA_DataType *_) {
7131  /* Decode the encoding mask */
7132  u8 encodingMask;
7133  status ret = Byte_decodeBinary(&encodingMask, NULL);
7134  if(ret != UA_STATUSCODE_GOOD)
7135  return ret;
7136 
7137  /* Decode the content */
7138  if(encodingMask & 0x01) {
7139  dst->hasSymbolicId = true;
7140  ret |= Int32_decodeBinary(&dst->symbolicId);
7141  }
7142  if(encodingMask & 0x02) {
7143  dst->hasNamespaceUri = true;
7144  ret |= Int32_decodeBinary(&dst->namespaceUri);
7145  }
7146  if(encodingMask & 0x04) {
7147  dst->hasLocalizedText = true;
7148  ret |= Int32_decodeBinary(&dst->localizedText);
7149  }
7150  if(encodingMask & 0x08) {
7151  dst->hasLocale = true;
7152  ret |= Int32_decodeBinary(&dst->locale);
7153  }
7154  if(encodingMask & 0x10) {
7155  dst->hasAdditionalInfo = true;
7156  ret |= String_decodeBinary(&dst->additionalInfo, NULL);
7157  }
7158  if(encodingMask & 0x20) {
7159  dst->hasInnerStatusCode = true;
7160  ret |= StatusCode_decodeBinary(&dst->innerStatusCode);
7161  }
7162  if(encodingMask & 0x40) {
7163  /* innerDiagnosticInfo is allocated on the heap */
7165  UA_calloc(1, sizeof(UA_DiagnosticInfo));
7166  if(!dst->innerDiagnosticInfo)
7168  dst->hasInnerDiagnosticInfo = true;
7169  ret |= DiagnosticInfo_decodeBinary(dst->innerDiagnosticInfo, NULL);
7170  }
7171  return ret;
7172 }
7173 
7174 /********************/
7175 /* Structured Types */
7176 /********************/
7177 
7178 static status
7179 UA_decodeBinaryInternal(void *dst, const UA_DataType *type);
7180 
7181 const UA_encodeBinarySignature encodeBinaryJumpTable[UA_BUILTIN_TYPES_COUNT + 1] = {
7182  (UA_encodeBinarySignature)Boolean_encodeBinary,
7183  (UA_encodeBinarySignature)Byte_encodeBinary, // SByte
7184  (UA_encodeBinarySignature)Byte_encodeBinary,
7185  (UA_encodeBinarySignature)UInt16_encodeBinary, // Int16
7186  (UA_encodeBinarySignature)UInt16_encodeBinary,
7187  (UA_encodeBinarySignature)UInt32_encodeBinary, // Int32
7188  (UA_encodeBinarySignature)UInt32_encodeBinary,
7189  (UA_encodeBinarySignature)UInt64_encodeBinary, // Int64
7190  (UA_encodeBinarySignature)UInt64_encodeBinary,
7191  (UA_encodeBinarySignature)Float_encodeBinary,
7192  (UA_encodeBinarySignature)Double_encodeBinary,
7193  (UA_encodeBinarySignature)String_encodeBinary,
7194  (UA_encodeBinarySignature)UInt64_encodeBinary, // DateTime
7195  (UA_encodeBinarySignature)Guid_encodeBinary,
7196  (UA_encodeBinarySignature)String_encodeBinary, // ByteString
7197  (UA_encodeBinarySignature)String_encodeBinary, // XmlElement
7198  (UA_encodeBinarySignature)NodeId_encodeBinary,
7199  (UA_encodeBinarySignature)ExpandedNodeId_encodeBinary,
7200  (UA_encodeBinarySignature)UInt32_encodeBinary, // StatusCode
7201  (UA_encodeBinarySignature)UA_encodeBinaryInternal, // QualifiedName
7202  (UA_encodeBinarySignature)LocalizedText_encodeBinary,
7203  (UA_encodeBinarySignature)ExtensionObject_encodeBinary,
7204  (UA_encodeBinarySignature)DataValue_encodeBinary,
7205  (UA_encodeBinarySignature)Variant_encodeBinary,
7206  (UA_encodeBinarySignature)DiagnosticInfo_encodeBinary,
7207  (UA_encodeBinarySignature)UA_encodeBinaryInternal,
7208 };
7209 
7210 static status
7211 UA_encodeBinaryInternal(const void *src, const UA_DataType *type) {
7212  uintptr_t ptr = (uintptr_t)src;
7213  status ret = UA_STATUSCODE_GOOD;
7214  u8 membersSize = type->membersSize;
7215  const UA_DataType *typelists[2] = { UA_TYPES, &type[-type->typeIndex] };
7216  for(size_t i = 0; i < membersSize && ret == UA_STATUSCODE_GOOD; ++i) {
7217  const UA_DataTypeMember *member = &type->members[i];
7218  const UA_DataType *membertype = &typelists[!member->namespaceZero][member->memberTypeIndex];
7219  if(!member->isArray) {
7220  ptr += member->padding;
7221  size_t encode_index = membertype->builtin ? membertype->typeIndex : UA_BUILTIN_TYPES_COUNT;
7222  size_t memSize = membertype->memSize;
7223  u8 *oldpos = g_pos;
7224  ret = encodeBinaryJumpTable[encode_index]((const void*)ptr, membertype);
7225  ptr += memSize;
7227  g_pos = oldpos; /* exchange/send the buffer */
7228  ret = exchangeBuffer();
7229  ptr -= member->padding + memSize; /* encode the same member in the next iteration */
7230  if(ret == UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED || g_pos + memSize > g_end) {
7231  /* the send buffer is too small to encode the member, even after exchangeBuffer */
7233  }
7234  --i;
7235  }
7236  } else {
7237  ptr += member->padding;
7238  const size_t length = *((const size_t*)ptr);
7239  ptr += sizeof(size_t);
7240  ret = Array_encodeBinary(*(void *UA_RESTRICT const *)ptr, length, membertype);
7241  ptr += sizeof(void*);
7242  }
7243  }
7245  return ret;
7246 }
7247 
7248 status
7249 UA_encodeBinary(const void *src, const UA_DataType *type,
7250  UA_exchangeEncodeBuffer exchangeCallback, void *exchangeHandle,
7251  UA_ByteString *dst, size_t *offset) {
7252  /* Set the (thread-local) pointers to save function arguments */
7253  g_buf = *dst;
7254  g_pos = &dst->data[*offset];
7255  g_end = &dst->data[dst->length];
7256  g_exchangeBufferCallback = exchangeCallback;
7257  g_exchangeBufferCallbackHandle = exchangeHandle;
7258  status ret = UA_encodeBinaryInternal(src, type);
7259 
7260  /* Set the current buffer position. Beware that the buffer might have been
7261  * exchanged internally. */
7262  *dst = g_buf;
7263  *offset = (uintptr_t)(g_pos - g_buf.data);
7264  return ret;
7265 }
7266 
7267 const UA_decodeBinarySignature decodeBinaryJumpTable[UA_BUILTIN_TYPES_COUNT + 1] = {
7268  (UA_decodeBinarySignature)Boolean_decodeBinary,
7269  (UA_decodeBinarySignature)Byte_decodeBinary, // SByte
7270  (UA_decodeBinarySignature)Byte_decodeBinary,
7271  (UA_decodeBinarySignature)UInt16_decodeBinary, // Int16
7272  (UA_decodeBinarySignature)UInt16_decodeBinary,
7273  (UA_decodeBinarySignature)UInt32_decodeBinary, // Int32
7274  (UA_decodeBinarySignature)UInt32_decodeBinary,
7275  (UA_decodeBinarySignature)UInt64_decodeBinary, // Int64
7276  (UA_decodeBinarySignature)UInt64_decodeBinary,
7277  (UA_decodeBinarySignature)Float_decodeBinary,
7278  (UA_decodeBinarySignature)Double_decodeBinary,
7279  (UA_decodeBinarySignature)String_decodeBinary,
7280  (UA_decodeBinarySignature)UInt64_decodeBinary, // DateTime
7281  (UA_decodeBinarySignature)Guid_decodeBinary,
7282  (UA_decodeBinarySignature)String_decodeBinary, // ByteString
7283  (UA_decodeBinarySignature)String_decodeBinary, // XmlElement
7284  (UA_decodeBinarySignature)NodeId_decodeBinary,
7285  (UA_decodeBinarySignature)ExpandedNodeId_decodeBinary,
7286  (UA_decodeBinarySignature)UInt32_decodeBinary, // StatusCode
7287  (UA_decodeBinarySignature)UA_decodeBinaryInternal, // QualifiedName
7288  (UA_decodeBinarySignature)LocalizedText_decodeBinary,
7289  (UA_decodeBinarySignature)ExtensionObject_decodeBinary,
7290  (UA_decodeBinarySignature)DataValue_decodeBinary,
7291  (UA_decodeBinarySignature)Variant_decodeBinary,
7292  (UA_decodeBinarySignature)DiagnosticInfo_decodeBinary,
7293  (UA_decodeBinarySignature)UA_decodeBinaryInternal
7294 };
7295 
7296 static status
7297 UA_decodeBinaryInternal(void *dst, const UA_DataType *type) {
7298  uintptr_t ptr = (uintptr_t)dst;
7299  status ret = UA_STATUSCODE_GOOD;
7300  u8 membersSize = type->membersSize;
7301  const UA_DataType *typelists[2] = { UA_TYPES, &type[-type->typeIndex] };
7302  for(size_t i = 0; i < membersSize && ret == UA_STATUSCODE_GOOD; ++i) {
7303  const UA_DataTypeMember *member = &type->members[i];
7304  const UA_DataType *membertype = &typelists[!member->namespaceZero][member->memberTypeIndex];
7305  if(!member->isArray) {
7306  ptr += member->padding;
7307  size_t fi = membertype->builtin ? membertype->typeIndex : UA_BUILTIN_TYPES_COUNT;
7308  size_t memSize = membertype->memSize;
7309  ret |= decodeBinaryJumpTable[fi]((void *UA_RESTRICT)ptr, membertype);
7310  ptr += memSize;
7311  } else {
7312  ptr += member->padding;
7313  size_t *length = (size_t*)ptr;
7314  ptr += sizeof(size_t);
7315  ret |= Array_decodeBinary((void *UA_RESTRICT *UA_RESTRICT)ptr, length, membertype);
7316  ptr += sizeof(void*);
7317  }
7318  }
7319  return ret;
7320 }
7321 
7322 status
7323 UA_decodeBinary(const UA_ByteString *src, size_t *offset, void *dst,
7324  const UA_DataType *type) {
7325  /* Initialize the destination */
7326  memset(dst, 0, type->memSize);
7327 
7328  /* Set the (thread-local) position and end pointers to save function
7329  * arguments */
7330  g_pos = &src->data[*offset];
7331  g_end = &src->data[src->length];
7332 
7333  /* Decode */
7334  status ret = UA_decodeBinaryInternal(dst, type);
7335 
7336  /* Clean up */
7337  if(ret == UA_STATUSCODE_GOOD)
7338  *offset = (size_t)(g_pos - src->data) / sizeof(u8);
7339  else
7340  UA_deleteMembers(dst, type);
7341  return ret;
7342 }
7343 
7344 /******************/
7345 /* CalcSizeBinary */
7346 /******************/
7347 
7348 static size_t
7349 Array_calcSizeBinary(const void *src, size_t length, const UA_DataType *type) {
7350  size_t s = 4; // length
7351  if(type->overlayable) {
7352  s += type->memSize * length;
7353  return s;
7354  }
7355  uintptr_t ptr = (uintptr_t)src;
7356  size_t encode_index = type->builtin ? type->typeIndex : UA_BUILTIN_TYPES_COUNT;
7357  for(size_t i = 0; i < length; ++i) {
7358  s += calcSizeBinaryJumpTable[encode_index]((const void*)ptr, type);
7359  ptr += type->memSize;
7360  }
7361  return s;
7362 }
7363 
7364 static size_t
7365 calcSizeBinaryMemSize(const void *UA_RESTRICT p, const UA_DataType *type) {
7366  return type->memSize;
7367 }
7368 
7369 static size_t
7370 String_calcSizeBinary(const UA_String *UA_RESTRICT p, const UA_DataType *_) {
7371  return 4 + p->length;
7372 }
7373 
7374 static size_t
7375 Guid_calcSizeBinary(const UA_Guid *UA_RESTRICT p, const UA_DataType *_) {
7376  return 16;
7377 }
7378 
7379 static size_t
7380 NodeId_calcSizeBinary(const UA_NodeId *UA_RESTRICT src, const UA_DataType *_) {
7381  size_t s = 1; // encoding byte
7382  switch (src->identifierType) {
7383  case UA_NODEIDTYPE_NUMERIC:
7384  if(src->identifier.numeric > UA_UINT16_MAX || src->namespaceIndex > UA_BYTE_MAX) {
7385  s += 6;
7386  } else if(src->identifier.numeric > UA_BYTE_MAX || src->namespaceIndex > 0) {
7387  s += 3;
7388  } else {
7389  s += 1;
7390  }
7391  break;
7393  case UA_NODEIDTYPE_STRING:
7394  s += 2;
7395  s += String_calcSizeBinary(&src->identifier.string, NULL);
7396  break;
7397  case UA_NODEIDTYPE_GUID:
7398  s += 18;
7399  break;
7400  default:
7401  return 0;
7402  }
7403  return s;
7404 }
7405 
7406 static size_t
7407 ExpandedNodeId_calcSizeBinary(const UA_ExpandedNodeId *src, const UA_DataType *_) {
7408  size_t s = NodeId_calcSizeBinary(&src->nodeId, NULL);
7409  if(src->namespaceUri.length > 0)
7410  s += String_calcSizeBinary(&src->namespaceUri, NULL);
7411  if(src->serverIndex > 0)
7412  s += 4;
7413  return s;
7414 }
7415 
7416 static size_t
7417 LocalizedText_calcSizeBinary(const UA_LocalizedText *src, UA_DataType *_) {
7418  size_t s = 1; // encoding byte
7419  if(src->locale.data)
7420  s += String_calcSizeBinary(&src->locale, NULL);
7421  if(src->text.data)
7422  s += String_calcSizeBinary(&src->text, NULL);
7423  return s;
7424 }
7425 
7426 static size_t
7427 ExtensionObject_calcSizeBinary(const UA_ExtensionObject *src, UA_DataType *_) {
7428  size_t s = 1; // encoding byte
7430  if(!src->content.decoded.type || !src->content.decoded.data)
7431  return 0;
7432  if(src->content.decoded.type->typeId.identifierType != UA_NODEIDTYPE_NUMERIC)
7433  return 0;
7434  s += NodeId_calcSizeBinary(&src->content.decoded.type->typeId, NULL);
7435  s += 4; // length
7436  const UA_DataType *type = src->content.decoded.type;
7437  size_t encode_index = type->builtin ? type->typeIndex : UA_BUILTIN_TYPES_COUNT;
7438  s += calcSizeBinaryJumpTable[encode_index](src->content.decoded.data, type);
7439  } else {
7440  s += NodeId_calcSizeBinary(&src->content.encoded.typeId, NULL);
7441  switch (src->encoding) {
7443  break;
7446  s += String_calcSizeBinary(&src->content.encoded.body, NULL);
7447  break;
7448  default:
7449  return 0;
7450  }
7451  }
7452  return s;
7453 }
7454 
7455 static size_t
7456 Variant_calcSizeBinary(UA_Variant const *src, UA_DataType *_) {
7457  size_t s = 1; /* encoding byte */
7458  if(!src->type)
7459  return s;
7460 
7461  bool isArray = src->arrayLength > 0 || src->data <= UA_EMPTY_ARRAY_SENTINEL;
7462  bool hasDimensions = isArray && src->arrayDimensionsSize > 0;
7463  bool isBuiltin = src->type->builtin;
7464 
7465  UA_NodeId typeId;
7466  UA_NodeId_init(&typeId);
7467  size_t encode_index = src->type->typeIndex;
7468  if(!isBuiltin) {
7469  encode_index = UA_BUILTIN_TYPES_COUNT;
7470  typeId = src->type->typeId;
7472  return 0;
7473  }
7474 
7475  size_t length = src->arrayLength;
7476  if(isArray)
7477  s += 4;
7478  else
7479  length = 1;
7480 
7481  uintptr_t ptr = (uintptr_t)src->data;
7482  size_t memSize = src->type->memSize;
7483  for(size_t i = 0; i < length; ++i) {
7484  if(!isBuiltin) {
7485  /* The type is wrapped inside an extensionobject */
7486  s += NodeId_calcSizeBinary(&typeId, NULL);
7487  s += 1 + 4; // encoding byte + length
7488  }
7489  s += calcSizeBinaryJumpTable[encode_index]((const void*)ptr, src->type);
7490  ptr += memSize;
7491  }
7492 
7493  if(hasDimensions)
7494  s += Array_calcSizeBinary(src->arrayDimensions, src->arrayDimensionsSize,
7496  return s;
7497 }
7498 
7499 static size_t
7500 DataValue_calcSizeBinary(const UA_DataValue *src, UA_DataType *_) {
7501  size_t s = 1; // encoding byte
7502  if(src->hasValue)
7503  s += Variant_calcSizeBinary(&src->value, NULL);
7504  if(src->hasStatus)
7505  s += 4;
7506  if(src->hasSourceTimestamp)
7507  s += 8;
7508  if(src->hasSourcePicoseconds)
7509  s += 2;
7510  if(src->hasServerTimestamp)
7511  s += 8;
7512  if(src->hasServerPicoseconds)
7513  s += 2;
7514  return s;
7515 }
7516 
7517 static size_t
7518 DiagnosticInfo_calcSizeBinary(const UA_DiagnosticInfo *src, UA_DataType *_) {
7519  size_t s = 1; // encoding byte
7520  if(src->hasSymbolicId)
7521  s += 4;
7522  if(src->hasNamespaceUri)
7523  s += 4;
7524  if(src->hasLocalizedText)
7525  s += 4;
7526  if(src->hasLocale)
7527  s += 4;
7528  if(src->hasAdditionalInfo)
7529  s += String_calcSizeBinary(&src->additionalInfo, NULL);
7530  if(src->hasInnerStatusCode)
7531  s += 4;
7532  if(src->hasInnerDiagnosticInfo)
7533  s += DiagnosticInfo_calcSizeBinary(src->innerDiagnosticInfo, NULL);
7534  return s;
7535 }
7536 
7537 const UA_calcSizeBinarySignature calcSizeBinaryJumpTable[UA_BUILTIN_TYPES_COUNT + 1] = {
7538  (UA_calcSizeBinarySignature)calcSizeBinaryMemSize, // Boolean
7539  (UA_calcSizeBinarySignature)calcSizeBinaryMemSize, // Byte
7540  (UA_calcSizeBinarySignature)calcSizeBinaryMemSize,
7541  (UA_calcSizeBinarySignature)calcSizeBinaryMemSize, // Int16
7542  (UA_calcSizeBinarySignature)calcSizeBinaryMemSize,
7543  (UA_calcSizeBinarySignature)calcSizeBinaryMemSize, // Int32
7544  (UA_calcSizeBinarySignature)calcSizeBinaryMemSize,
7545  (UA_calcSizeBinarySignature)calcSizeBinaryMemSize, // Int64
7546  (UA_calcSizeBinarySignature)calcSizeBinaryMemSize,
7547  (UA_calcSizeBinarySignature)calcSizeBinaryMemSize, // Float
7548  (UA_calcSizeBinarySignature)calcSizeBinaryMemSize, // Double
7549  (UA_calcSizeBinarySignature)String_calcSizeBinary,
7550  (UA_calcSizeBinarySignature)calcSizeBinaryMemSize, // DateTime
7551  (UA_calcSizeBinarySignature)Guid_calcSizeBinary,
7552  (UA_calcSizeBinarySignature)String_calcSizeBinary, // ByteString
7553  (UA_calcSizeBinarySignature)String_calcSizeBinary, // XmlElement
7554  (UA_calcSizeBinarySignature)NodeId_calcSizeBinary,
7555  (UA_calcSizeBinarySignature)ExpandedNodeId_calcSizeBinary,
7556  (UA_calcSizeBinarySignature)calcSizeBinaryMemSize, // StatusCode
7558  (UA_calcSizeBinarySignature)LocalizedText_calcSizeBinary,
7559  (UA_calcSizeBinarySignature)ExtensionObject_calcSizeBinary,
7560  (UA_calcSizeBinarySignature)DataValue_calcSizeBinary,
7561  (UA_calcSizeBinarySignature)Variant_calcSizeBinary,
7562  (UA_calcSizeBinarySignature)DiagnosticInfo_calcSizeBinary,
7564 };
7565 
7566 size_t
7567 UA_calcSizeBinary(void *p, const UA_DataType *type) {
7568  size_t s = 0;
7569  uintptr_t ptr = (uintptr_t)p;
7570  u8 membersSize = type->membersSize;
7571  const UA_DataType *typelists[2] = { UA_TYPES, &type[-type->typeIndex] };
7572  for(size_t i = 0; i < membersSize; ++i) {
7573  const UA_DataTypeMember *member = &type->members[i];
7574  const UA_DataType *membertype = &typelists[!member->namespaceZero][member->memberTypeIndex];
7575  if(!member->isArray) {
7576  ptr += member->padding;
7577  size_t encode_index = membertype->builtin ? membertype->typeIndex : UA_BUILTIN_TYPES_COUNT;
7578  s += calcSizeBinaryJumpTable[encode_index]((const void*)ptr, membertype);
7579  ptr += membertype->memSize;
7580  } else {
7581  ptr += member->padding;
7582  const size_t length = *((const size_t*)ptr);
7583  ptr += sizeof(size_t);
7584  s += Array_calcSizeBinary(*(void *UA_RESTRICT const *)ptr, length, membertype);
7585  ptr += sizeof(void*);
7586  }
7587  }
7588  return s;
7589 }
7590 
7591 /*********************************** amalgamated original file "/home/iosb/sw/open62541/build/src_generated/ua_types_generated.c" ***********************************/
7592 
7593 /* Generated from Opc.Ua.Types.bsd with script /home/iosb/sw/open62541/tools/generate_datatypes.py
7594  * on host iosb-VirtualBox by user iosb at 2018-11-29 10:33:07 */
7595 
7596 
7597 /* Boolean */
7598 static UA_DataTypeMember Boolean_members[1] = {
7600 #ifdef UA_ENABLE_TYPENAMES
7601  .memberName = "",
7602 #endif
7603  .namespaceZero = true,
7604  .padding = 0,
7605  .isArray = false
7606  },};
7607 
7608 /* SByte */
7609 static UA_DataTypeMember SByte_members[1] = {
7611 #ifdef UA_ENABLE_TYPENAMES
7612  .memberName = "",
7613 #endif
7614  .namespaceZero = true,
7615  .padding = 0,
7616  .isArray = false
7617  },};
7618 
7619 /* Byte */
7620 static UA_DataTypeMember Byte_members[1] = {
7622 #ifdef UA_ENABLE_TYPENAMES
7623  .memberName = "",
7624 #endif
7625  .namespaceZero = true,
7626  .padding = 0,
7627  .isArray = false
7628  },};
7629 
7630 /* Int16 */
7631 static UA_DataTypeMember Int16_members[1] = {
7633 #ifdef UA_ENABLE_TYPENAMES
7634  .memberName = "",
7635 #endif
7636  .namespaceZero = true,
7637  .padding = 0,
7638  .isArray = false
7639  },};
7640 
7641 /* UInt16 */
7642 static UA_DataTypeMember UInt16_members[1] = {
7644 #ifdef UA_ENABLE_TYPENAMES
7645  .memberName = "",
7646 #endif
7647  .namespaceZero = true,
7648  .padding = 0,
7649  .isArray = false
7650  },};
7651 
7652 /* Int32 */
7653 static UA_DataTypeMember Int32_members[1] = {
7655 #ifdef UA_ENABLE_TYPENAMES
7656  .memberName = "",
7657 #endif
7658  .namespaceZero = true,
7659  .padding = 0,
7660  .isArray = false
7661  },};
7662 
7663 /* UInt32 */
7664 static UA_DataTypeMember UInt32_members[1] = {
7666 #ifdef UA_ENABLE_TYPENAMES
7667  .memberName = "",
7668 #endif
7669  .namespaceZero = true,
7670  .padding = 0,
7671  .isArray = false
7672  },};
7673 
7674 /* Int64 */
7675 static UA_DataTypeMember Int64_members[1] = {
7677 #ifdef UA_ENABLE_TYPENAMES
7678  .memberName = "",
7679 #endif
7680  .namespaceZero = true,
7681  .padding = 0,
7682  .isArray = false
7683  },};
7684 
7685 /* UInt64 */
7686 static UA_DataTypeMember UInt64_members[1] = {
7688 #ifdef UA_ENABLE_TYPENAMES
7689  .memberName = "",
7690 #endif
7691  .namespaceZero = true,
7692  .padding = 0,
7693  .isArray = false
7694  },};
7695 
7696 /* Float */
7697 static UA_DataTypeMember Float_members[1] = {
7699 #ifdef UA_ENABLE_TYPENAMES
7700  .memberName = "",
7701 #endif
7702  .namespaceZero = true,
7703  .padding = 0,
7704  .isArray = false
7705  },};
7706 
7707 /* Double */
7708 static UA_DataTypeMember Double_members[1] = {
7710 #ifdef UA_ENABLE_TYPENAMES
7711  .memberName = "",
7712 #endif
7713  .namespaceZero = true,
7714  .padding = 0,
7715  .isArray = false
7716  },};
7717 
7718 /* String */
7719 static UA_DataTypeMember String_members[1] = {
7721 #ifdef UA_ENABLE_TYPENAMES
7722  .memberName = "",
7723 #endif
7724  .namespaceZero = true,
7725  .padding = 0,
7726  .isArray = true
7727  },};
7728 
7729 /* DateTime */
7730 static UA_DataTypeMember DateTime_members[1] = {
7732 #ifdef UA_ENABLE_TYPENAMES
7733  .memberName = "",
7734 #endif
7735  .namespaceZero = true,
7736  .padding = 0,
7737  .isArray = false
7738  },};
7739 
7740 /* Guid */
7741 static UA_DataTypeMember Guid_members[1] = {
7743 #ifdef UA_ENABLE_TYPENAMES
7744  .memberName = "",
7745 #endif
7746  .namespaceZero = true,
7747  .padding = 0,
7748  .isArray = false
7749  },};
7750 
7751 /* ByteString */
7752 static UA_DataTypeMember ByteString_members[1] = {
7754 #ifdef UA_ENABLE_TYPENAMES
7755  .memberName = "",
7756 #endif
7757  .namespaceZero = true,
7758  .padding = 0,
7759  .isArray = true
7760  },};
7761 
7762 /* XmlElement */
7763 static UA_DataTypeMember XmlElement_members[1] = {
7765 #ifdef UA_ENABLE_TYPENAMES
7766  .memberName = "",
7767 #endif
7768  .namespaceZero = true,
7769  .padding = 0,
7770  .isArray = true
7771  },};
7772 
7773 /* NodeId */
7774 static UA_DataTypeMember NodeId_members[1] = {
7776 #ifdef UA_ENABLE_TYPENAMES
7777  .memberName = "",
7778 #endif
7779  .namespaceZero = true,
7780  .padding = 0,
7781  .isArray = false
7782  },};
7783 
7784 /* ExpandedNodeId */
7785 static UA_DataTypeMember ExpandedNodeId_members[1] = {
7787 #ifdef UA_ENABLE_TYPENAMES
7788  .memberName = "",
7789 #endif
7790  .namespaceZero = true,
7791  .padding = 0,
7792  .isArray = false
7793  },};
7794 
7795 /* StatusCode */
7796 static UA_DataTypeMember StatusCode_members[1] = {
7798 #ifdef UA_ENABLE_TYPENAMES
7799  .memberName = "",
7800 #endif
7801  .namespaceZero = true,
7802  .padding = 0,
7803  .isArray = false
7804  },};
7805 
7806 /* QualifiedName */
7807 static UA_DataTypeMember QualifiedName_members[2] = {
7809 #ifdef UA_ENABLE_TYPENAMES
7810  .memberName = "namespaceIndex",
7811 #endif
7812  .namespaceZero = true,
7813  .padding = 0,
7814  .isArray = false
7815  },
7816  { .memberTypeIndex = UA_TYPES_STRING,
7817 #ifdef UA_ENABLE_TYPENAMES
7818  .memberName = "name",
7819 #endif
7820  .namespaceZero = true,
7821  .padding = offsetof(UA_QualifiedName, name) - offsetof(UA_QualifiedName, namespaceIndex) - sizeof(UA_Int16),
7822  .isArray = false
7823  },};
7824 
7825 /* LocalizedText */
7826 static UA_DataTypeMember LocalizedText_members[1] = {
7828 #ifdef UA_ENABLE_TYPENAMES
7829  .memberName = "",
7830 #endif
7831  .namespaceZero = true,
7832  .padding = 0,
7833  .isArray = false
7834  },};
7835 
7836 /* ExtensionObject */
7837 static UA_DataTypeMember ExtensionObject_members[1] = {
7839 #ifdef UA_ENABLE_TYPENAMES
7840  .memberName = "",
7841 #endif
7842  .namespaceZero = true,
7843  .padding = 0,
7844  .isArray = false
7845  },};
7846 
7847 /* DataValue */
7848 static UA_DataTypeMember DataValue_members[1] = {
7850 #ifdef UA_ENABLE_TYPENAMES
7851  .memberName = "",
7852 #endif
7853  .namespaceZero = true,
7854  .padding = 0,
7855  .isArray = false
7856  },};
7857 
7858 /* Variant */
7859 static UA_DataTypeMember Variant_members[1] = {
7861 #ifdef UA_ENABLE_TYPENAMES
7862  .memberName = "",
7863 #endif
7864  .namespaceZero = true,
7865  .padding = 0,
7866  .isArray = false
7867  },};
7868 
7869 /* DiagnosticInfo */
7870 static UA_DataTypeMember DiagnosticInfo_members[1] = {
7872 #ifdef UA_ENABLE_TYPENAMES
7873  .memberName = "",
7874 #endif
7875  .namespaceZero = true,
7876  .padding = 0,
7877  .isArray = false
7878  },};
7879 
7880 /* SignedSoftwareCertificate */
7881 static UA_DataTypeMember SignedSoftwareCertificate_members[2] = {
7883 #ifdef UA_ENABLE_TYPENAMES
7884  .memberName = "certificateData",
7885 #endif
7886  .namespaceZero = true,
7887  .padding = 0,
7888  .isArray = false
7889  },
7890  { .memberTypeIndex = UA_TYPES_BYTESTRING,
7891 #ifdef UA_ENABLE_TYPENAMES
7892  .memberName = "signature",
7893 #endif
7894  .namespaceZero = true,
7895  .padding = offsetof(UA_SignedSoftwareCertificate, signature) - offsetof(UA_SignedSoftwareCertificate, certificateData) - sizeof(UA_ByteString),
7896  .isArray = false
7897  },};
7898 
7899 /* BrowsePathTarget */
7900 static UA_DataTypeMember BrowsePathTarget_members[2] = {
7902 #ifdef UA_ENABLE_TYPENAMES
7903  .memberName = "targetId",
7904 #endif
7905  .namespaceZero = true,
7906  .padding = 0,
7907  .isArray = false
7908  },
7909  { .memberTypeIndex = UA_TYPES_UINT32,
7910 #ifdef UA_ENABLE_TYPENAMES
7911  .memberName = "remainingPathIndex",
7912 #endif
7913  .namespaceZero = true,
7914  .padding = offsetof(UA_BrowsePathTarget, remainingPathIndex) - offsetof(UA_BrowsePathTarget, targetId) - sizeof(UA_ExpandedNodeId),
7915  .isArray = false
7916  },};
7917 
7918 /* ViewAttributes */
7919 static UA_DataTypeMember ViewAttributes_members[7] = {
7921 #ifdef UA_ENABLE_TYPENAMES
7922  .memberName = "specifiedAttributes",
7923 #endif
7924  .namespaceZero = true,
7925  .padding = 0,
7926  .isArray = false
7927  },
7928  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
7929 #ifdef UA_ENABLE_TYPENAMES
7930  .memberName = "displayName",
7931 #endif
7932  .namespaceZero = true,
7933  .padding = offsetof(UA_ViewAttributes, displayName) - offsetof(UA_ViewAttributes, specifiedAttributes) - sizeof(UA_UInt32),
7934  .isArray = false
7935  },
7936  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
7937 #ifdef UA_ENABLE_TYPENAMES
7938  .memberName = "description",
7939 #endif
7940  .namespaceZero = true,
7941  .padding = offsetof(UA_ViewAttributes, description) - offsetof(UA_ViewAttributes, displayName) - sizeof(UA_LocalizedText),
7942  .isArray = false
7943  },
7944  { .memberTypeIndex = UA_TYPES_UINT32,
7945 #ifdef UA_ENABLE_TYPENAMES
7946  .memberName = "writeMask",
7947 #endif
7948  .namespaceZero = true,
7949  .padding = offsetof(UA_ViewAttributes, writeMask) - offsetof(UA_ViewAttributes, description) - sizeof(UA_LocalizedText),
7950  .isArray = false
7951  },
7952  { .memberTypeIndex = UA_TYPES_UINT32,
7953 #ifdef UA_ENABLE_TYPENAMES
7954  .memberName = "userWriteMask",
7955 #endif
7956  .namespaceZero = true,
7957  .padding = offsetof(UA_ViewAttributes, userWriteMask) - offsetof(UA_ViewAttributes, writeMask) - sizeof(UA_UInt32),
7958  .isArray = false
7959  },
7960  { .memberTypeIndex = UA_TYPES_BOOLEAN,
7961 #ifdef UA_ENABLE_TYPENAMES
7962  .memberName = "containsNoLoops",
7963 #endif
7964  .namespaceZero = true,
7965  .padding = offsetof(UA_ViewAttributes, containsNoLoops) - offsetof(UA_ViewAttributes, userWriteMask) - sizeof(UA_UInt32),
7966  .isArray = false
7967  },
7968  { .memberTypeIndex = UA_TYPES_BYTE,
7969 #ifdef UA_ENABLE_TYPENAMES
7970  .memberName = "eventNotifier",
7971 #endif
7972  .namespaceZero = true,
7973  .padding = offsetof(UA_ViewAttributes, eventNotifier) - offsetof(UA_ViewAttributes, containsNoLoops) - sizeof(UA_Boolean),
7974  .isArray = false
7975  },};
7976 
7977 /* BrowseResultMask */
7978 static UA_DataTypeMember BrowseResultMask_members[1] = {
7980 #ifdef UA_ENABLE_TYPENAMES
7981  .memberName = "",
7982 #endif
7983  .namespaceZero = true,
7984  .padding = 0,
7985  .isArray = false
7986  },};
7987 
7988 /* RequestHeader */
7989 static UA_DataTypeMember RequestHeader_members[7] = {
7991 #ifdef UA_ENABLE_TYPENAMES
7992  .memberName = "authenticationToken",
7993 #endif
7994  .namespaceZero = true,
7995  .padding = 0,
7996  .isArray = false
7997  },
7998  { .memberTypeIndex = UA_TYPES_DATETIME,
7999 #ifdef UA_ENABLE_TYPENAMES
8000  .memberName = "timestamp",
8001 #endif
8002  .namespaceZero = true,
8003  .padding = offsetof(UA_RequestHeader, timestamp) - offsetof(UA_RequestHeader, authenticationToken) - sizeof(UA_NodeId),
8004  .isArray = false
8005  },
8006  { .memberTypeIndex = UA_TYPES_UINT32,
8007 #ifdef UA_ENABLE_TYPENAMES
8008  .memberName = "requestHandle",
8009 #endif
8010  .namespaceZero = true,
8011  .padding = offsetof(UA_RequestHeader, requestHandle) - offsetof(UA_RequestHeader, timestamp) - sizeof(UA_DateTime),
8012  .isArray = false
8013  },
8014  { .memberTypeIndex = UA_TYPES_UINT32,
8015 #ifdef UA_ENABLE_TYPENAMES
8016  .memberName = "returnDiagnostics",
8017 #endif
8018  .namespaceZero = true,
8019  .padding = offsetof(UA_RequestHeader, returnDiagnostics) - offsetof(UA_RequestHeader, requestHandle) - sizeof(UA_UInt32),
8020  .isArray = false
8021  },
8022  { .memberTypeIndex = UA_TYPES_STRING,
8023 #ifdef UA_ENABLE_TYPENAMES
8024  .memberName = "auditEntryId",
8025 #endif
8026  .namespaceZero = true,
8027  .padding = offsetof(UA_RequestHeader, auditEntryId) - offsetof(UA_RequestHeader, returnDiagnostics) - sizeof(UA_UInt32),
8028  .isArray = false
8029  },
8030  { .memberTypeIndex = UA_TYPES_UINT32,
8031 #ifdef UA_ENABLE_TYPENAMES
8032  .memberName = "timeoutHint",
8033 #endif
8034  .namespaceZero = true,
8035  .padding = offsetof(UA_RequestHeader, timeoutHint) - offsetof(UA_RequestHeader, auditEntryId) - sizeof(UA_String),
8036  .isArray = false
8037  },
8038  { .memberTypeIndex = UA_TYPES_EXTENSIONOBJECT,
8039 #ifdef UA_ENABLE_TYPENAMES
8040  .memberName = "additionalHeader",
8041 #endif
8042  .namespaceZero = true,
8043  .padding = offsetof(UA_RequestHeader, additionalHeader) - offsetof(UA_RequestHeader, timeoutHint) - sizeof(UA_UInt32),
8044  .isArray = false
8045  },};
8046 
8047 /* MonitoredItemModifyResult */
8048 static UA_DataTypeMember MonitoredItemModifyResult_members[4] = {
8050 #ifdef UA_ENABLE_TYPENAMES
8051  .memberName = "statusCode",
8052 #endif
8053  .namespaceZero = true,
8054  .padding = 0,
8055  .isArray = false
8056  },
8057  { .memberTypeIndex = UA_TYPES_DOUBLE,
8058 #ifdef UA_ENABLE_TYPENAMES
8059  .memberName = "revisedSamplingInterval",
8060 #endif
8061  .namespaceZero = true,
8062  .padding = offsetof(UA_MonitoredItemModifyResult, revisedSamplingInterval) - offsetof(UA_MonitoredItemModifyResult, statusCode) - sizeof(UA_StatusCode),
8063  .isArray = false
8064  },
8065  { .memberTypeIndex = UA_TYPES_UINT32,
8066 #ifdef UA_ENABLE_TYPENAMES
8067  .memberName = "revisedQueueSize",
8068 #endif
8069  .namespaceZero = true,
8070  .padding = offsetof(UA_MonitoredItemModifyResult, revisedQueueSize) - offsetof(UA_MonitoredItemModifyResult, revisedSamplingInterval) - sizeof(UA_Double),
8071  .isArray = false
8072  },
8073  { .memberTypeIndex = UA_TYPES_EXTENSIONOBJECT,
8074 #ifdef UA_ENABLE_TYPENAMES
8075  .memberName = "filterResult",
8076 #endif
8077  .namespaceZero = true,
8078  .padding = offsetof(UA_MonitoredItemModifyResult, filterResult) - offsetof(UA_MonitoredItemModifyResult, revisedQueueSize) - sizeof(UA_UInt32),
8079  .isArray = false
8080  },};
8081 
8082 /* CloseSecureChannelRequest */
8083 static UA_DataTypeMember CloseSecureChannelRequest_members[1] = {
8085 #ifdef UA_ENABLE_TYPENAMES
8086  .memberName = "requestHeader",
8087 #endif
8088  .namespaceZero = true,
8089  .padding = 0,
8090  .isArray = false
8091  },};
8092 
8093 /* AddNodesResult */
8094 static UA_DataTypeMember AddNodesResult_members[2] = {
8096 #ifdef UA_ENABLE_TYPENAMES
8097  .memberName = "statusCode",
8098 #endif
8099  .namespaceZero = true,
8100  .padding = 0,
8101  .isArray = false
8102  },
8103  { .memberTypeIndex = UA_TYPES_NODEID,
8104 #ifdef UA_ENABLE_TYPENAMES
8105  .memberName = "addedNodeId",
8106 #endif
8107  .namespaceZero = true,
8108  .padding = offsetof(UA_AddNodesResult, addedNodeId) - offsetof(UA_AddNodesResult, statusCode) - sizeof(UA_StatusCode),
8109  .isArray = false
8110  },};
8111 
8112 /* VariableAttributes */
8113 static UA_DataTypeMember VariableAttributes_members[13] = {
8115 #ifdef UA_ENABLE_TYPENAMES
8116  .memberName = "specifiedAttributes",
8117 #endif
8118  .namespaceZero = true,
8119  .padding = 0,
8120  .isArray = false
8121  },
8122  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
8123 #ifdef UA_ENABLE_TYPENAMES
8124  .memberName = "displayName",
8125 #endif
8126  .namespaceZero = true,
8127  .padding = offsetof(UA_VariableAttributes, displayName) - offsetof(UA_VariableAttributes, specifiedAttributes) - sizeof(UA_UInt32),
8128  .isArray = false
8129  },
8130  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
8131 #ifdef UA_ENABLE_TYPENAMES
8132  .memberName = "description",
8133 #endif
8134  .namespaceZero = true,
8135  .padding = offsetof(UA_VariableAttributes, description) - offsetof(UA_VariableAttributes, displayName) - sizeof(UA_LocalizedText),
8136  .isArray = false
8137  },
8138  { .memberTypeIndex = UA_TYPES_UINT32,
8139 #ifdef UA_ENABLE_TYPENAMES
8140  .memberName = "writeMask",
8141 #endif
8142  .namespaceZero = true,
8143  .padding = offsetof(UA_VariableAttributes, writeMask) - offsetof(UA_VariableAttributes, description) - sizeof(UA_LocalizedText),
8144  .isArray = false
8145  },
8146  { .memberTypeIndex = UA_TYPES_UINT32,
8147 #ifdef UA_ENABLE_TYPENAMES
8148  .memberName = "userWriteMask",
8149 #endif
8150  .namespaceZero = true,
8151  .padding = offsetof(UA_VariableAttributes, userWriteMask) - offsetof(UA_VariableAttributes, writeMask) - sizeof(UA_UInt32),
8152  .isArray = false
8153  },
8154  { .memberTypeIndex = UA_TYPES_VARIANT,
8155 #ifdef UA_ENABLE_TYPENAMES
8156  .memberName = "value",
8157 #endif
8158  .namespaceZero = true,
8159  .padding = offsetof(UA_VariableAttributes, value) - offsetof(UA_VariableAttributes, userWriteMask) - sizeof(UA_UInt32),
8160  .isArray = false
8161  },
8162  { .memberTypeIndex = UA_TYPES_NODEID,
8163 #ifdef UA_ENABLE_TYPENAMES
8164  .memberName = "dataType",
8165 #endif
8166  .namespaceZero = true,
8167  .padding = offsetof(UA_VariableAttributes, dataType) - offsetof(UA_VariableAttributes, value) - sizeof(UA_Variant),
8168  .isArray = false
8169  },
8170  { .memberTypeIndex = UA_TYPES_INT32,
8171 #ifdef UA_ENABLE_TYPENAMES
8172  .memberName = "valueRank",
8173 #endif
8174  .namespaceZero = true,
8175  .padding = offsetof(UA_VariableAttributes, valueRank) - offsetof(UA_VariableAttributes, dataType) - sizeof(UA_NodeId),
8176  .isArray = false
8177  },
8178  { .memberTypeIndex = UA_TYPES_UINT32,
8179 #ifdef UA_ENABLE_TYPENAMES
8180  .memberName = "arrayDimensions",
8181 #endif
8182  .namespaceZero = true,
8183  .padding = offsetof(UA_VariableAttributes, arrayDimensionsSize) - offsetof(UA_VariableAttributes, valueRank) - sizeof(UA_Int32),
8184  .isArray = true
8185  },
8186  { .memberTypeIndex = UA_TYPES_BYTE,
8187 #ifdef UA_ENABLE_TYPENAMES
8188  .memberName = "accessLevel",
8189 #endif
8190  .namespaceZero = true,
8191  .padding = offsetof(UA_VariableAttributes, accessLevel) - offsetof(UA_VariableAttributes, arrayDimensions) - sizeof(void*),
8192  .isArray = false
8193  },
8194  { .memberTypeIndex = UA_TYPES_BYTE,
8195 #ifdef UA_ENABLE_TYPENAMES
8196  .memberName = "userAccessLevel",
8197 #endif
8198  .namespaceZero = true,
8199  .padding = offsetof(UA_VariableAttributes, userAccessLevel) - offsetof(UA_VariableAttributes, accessLevel) - sizeof(UA_Byte),
8200  .isArray = false
8201  },
8202  { .memberTypeIndex = UA_TYPES_DOUBLE,
8203 #ifdef UA_ENABLE_TYPENAMES
8204  .memberName = "minimumSamplingInterval",
8205 #endif
8206  .namespaceZero = true,
8207  .padding = offsetof(UA_VariableAttributes, minimumSamplingInterval) - offsetof(UA_VariableAttributes, userAccessLevel) - sizeof(UA_Byte),
8208  .isArray = false
8209  },
8210  { .memberTypeIndex = UA_TYPES_BOOLEAN,
8211 #ifdef UA_ENABLE_TYPENAMES
8212  .memberName = "historizing",
8213 #endif
8214  .namespaceZero = true,
8215  .padding = offsetof(UA_VariableAttributes, historizing) - offsetof(UA_VariableAttributes, minimumSamplingInterval) - sizeof(UA_Double),
8216  .isArray = false
8217  },};
8218 
8219 /* NotificationMessage */
8220 static UA_DataTypeMember NotificationMessage_members[3] = {
8222 #ifdef UA_ENABLE_TYPENAMES
8223  .memberName = "sequenceNumber",
8224 #endif
8225  .namespaceZero = true,
8226  .padding = 0,
8227  .isArray = false
8228  },
8229  { .memberTypeIndex = UA_TYPES_DATETIME,
8230 #ifdef UA_ENABLE_TYPENAMES
8231  .memberName = "publishTime",
8232 #endif
8233  .namespaceZero = true,
8234  .padding = offsetof(UA_NotificationMessage, publishTime) - offsetof(UA_NotificationMessage, sequenceNumber) - sizeof(UA_UInt32),
8235  .isArray = false
8236  },
8237  { .memberTypeIndex = UA_TYPES_EXTENSIONOBJECT,
8238 #ifdef UA_ENABLE_TYPENAMES
8239  .memberName = "notificationData",
8240 #endif
8241  .namespaceZero = true,
8242  .padding = offsetof(UA_NotificationMessage, notificationDataSize) - offsetof(UA_NotificationMessage, publishTime) - sizeof(UA_DateTime),
8243  .isArray = true
8244  },};
8245 
8246 /* NodeAttributesMask */
8247 static UA_DataTypeMember NodeAttributesMask_members[1] = {
8249 #ifdef UA_ENABLE_TYPENAMES
8250  .memberName = "",
8251 #endif
8252  .namespaceZero = true,
8253  .padding = 0,
8254  .isArray = false
8255  },};
8256 
8257 /* MonitoringMode */
8258 static UA_DataTypeMember MonitoringMode_members[1] = {
8260 #ifdef UA_ENABLE_TYPENAMES
8261  .memberName = "",
8262 #endif
8263  .namespaceZero = true,
8264  .padding = 0,
8265  .isArray = false
8266  },};
8267 
8268 /* CallMethodResult */
8269 static UA_DataTypeMember CallMethodResult_members[4] = {
8271 #ifdef UA_ENABLE_TYPENAMES
8272  .memberName = "statusCode",
8273 #endif
8274  .namespaceZero = true,
8275  .padding = 0,
8276  .isArray = false
8277  },
8278  { .memberTypeIndex = UA_TYPES_STATUSCODE,
8279 #ifdef UA_ENABLE_TYPENAMES
8280  .memberName = "inputArgumentResults",
8281 #endif
8282  .namespaceZero = true,
8283  .padding = offsetof(UA_CallMethodResult, inputArgumentResultsSize) - offsetof(UA_CallMethodResult, statusCode) - sizeof(UA_StatusCode),
8284  .isArray = true
8285  },
8286  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
8287 #ifdef UA_ENABLE_TYPENAMES
8288  .memberName = "inputArgumentDiagnosticInfos",
8289 #endif
8290  .namespaceZero = true,
8291  .padding = offsetof(UA_CallMethodResult, inputArgumentDiagnosticInfosSize) - offsetof(UA_CallMethodResult, inputArgumentResults) - sizeof(void*),
8292  .isArray = true
8293  },
8294  { .memberTypeIndex = UA_TYPES_VARIANT,
8295 #ifdef UA_ENABLE_TYPENAMES
8296  .memberName = "outputArguments",
8297 #endif
8298  .namespaceZero = true,
8299  .padding = offsetof(UA_CallMethodResult, outputArgumentsSize) - offsetof(UA_CallMethodResult, inputArgumentDiagnosticInfos) - sizeof(void*),
8300  .isArray = true
8301  },};
8302 
8303 /* ParsingResult */
8304 static UA_DataTypeMember ParsingResult_members[3] = {
8306 #ifdef UA_ENABLE_TYPENAMES
8307  .memberName = "statusCode",
8308 #endif
8309  .namespaceZero = true,
8310  .padding = 0,
8311  .isArray = false
8312  },
8313  { .memberTypeIndex = UA_TYPES_STATUSCODE,
8314 #ifdef UA_ENABLE_TYPENAMES
8315  .memberName = "dataStatusCodes",
8316 #endif
8317  .namespaceZero = true,
8318  .padding = offsetof(UA_ParsingResult, dataStatusCodesSize) - offsetof(UA_ParsingResult, statusCode) - sizeof(UA_StatusCode),
8319  .isArray = true
8320  },
8321  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
8322 #ifdef UA_ENABLE_TYPENAMES
8323  .memberName = "dataDiagnosticInfos",
8324 #endif
8325  .namespaceZero = true,
8326  .padding = offsetof(UA_ParsingResult, dataDiagnosticInfosSize) - offsetof(UA_ParsingResult, dataStatusCodes) - sizeof(void*),
8327  .isArray = true
8328  },};
8329 
8330 /* RelativePathElement */
8331 static UA_DataTypeMember RelativePathElement_members[4] = {
8333 #ifdef UA_ENABLE_TYPENAMES
8334  .memberName = "referenceTypeId",
8335 #endif
8336  .namespaceZero = true,
8337  .padding = 0,
8338  .isArray = false
8339  },
8340  { .memberTypeIndex = UA_TYPES_BOOLEAN,
8341 #ifdef UA_ENABLE_TYPENAMES
8342  .memberName = "isInverse",
8343 #endif
8344  .namespaceZero = true,
8345  .padding = offsetof(UA_RelativePathElement, isInverse) - offsetof(UA_RelativePathElement, referenceTypeId) - sizeof(UA_NodeId),
8346  .isArray = false
8347  },
8348  { .memberTypeIndex = UA_TYPES_BOOLEAN,
8349 #ifdef UA_ENABLE_TYPENAMES
8350  .memberName = "includeSubtypes",
8351 #endif
8352  .namespaceZero = true,
8353  .padding = offsetof(UA_RelativePathElement, includeSubtypes) - offsetof(UA_RelativePathElement, isInverse) - sizeof(UA_Boolean),
8354  .isArray = false
8355  },
8356  { .memberTypeIndex = UA_TYPES_QUALIFIEDNAME,
8357 #ifdef UA_ENABLE_TYPENAMES
8358  .memberName = "targetName",
8359 #endif
8360  .namespaceZero = true,
8361  .padding = offsetof(UA_RelativePathElement, targetName) - offsetof(UA_RelativePathElement, includeSubtypes) - sizeof(UA_Boolean),
8362  .isArray = false
8363  },};
8364 
8365 /* BrowseDirection */
8366 static UA_DataTypeMember BrowseDirection_members[1] = {
8368 #ifdef UA_ENABLE_TYPENAMES
8369  .memberName = "",
8370 #endif
8371  .namespaceZero = true,
8372  .padding = 0,
8373  .isArray = false
8374  },};
8375 
8376 /* CallMethodRequest */
8377 static UA_DataTypeMember CallMethodRequest_members[3] = {
8379 #ifdef UA_ENABLE_TYPENAMES
8380  .memberName = "objectId",
8381 #endif
8382  .namespaceZero = true,
8383  .padding = 0,
8384  .isArray = false
8385  },
8386  { .memberTypeIndex = UA_TYPES_NODEID,
8387 #ifdef UA_ENABLE_TYPENAMES
8388  .memberName = "methodId",
8389 #endif
8390  .namespaceZero = true,
8391  .padding = offsetof(UA_CallMethodRequest, methodId) - offsetof(UA_CallMethodRequest, objectId) - sizeof(UA_NodeId),
8392  .isArray = false
8393  },
8394  { .memberTypeIndex = UA_TYPES_VARIANT,
8395 #ifdef UA_ENABLE_TYPENAMES
8396  .memberName = "inputArguments",
8397 #endif
8398  .namespaceZero = true,
8399  .padding = offsetof(UA_CallMethodRequest, inputArgumentsSize) - offsetof(UA_CallMethodRequest, methodId) - sizeof(UA_NodeId),
8400  .isArray = true
8401  },};
8402 
8403 /* UnregisterNodesRequest */
8404 static UA_DataTypeMember UnregisterNodesRequest_members[2] = {
8406 #ifdef UA_ENABLE_TYPENAMES
8407  .memberName = "requestHeader",
8408 #endif
8409  .namespaceZero = true,
8410  .padding = 0,
8411  .isArray = false
8412  },
8413  { .memberTypeIndex = UA_TYPES_NODEID,
8414 #ifdef UA_ENABLE_TYPENAMES
8415  .memberName = "nodesToUnregister",
8416 #endif
8417  .namespaceZero = true,
8418  .padding = offsetof(UA_UnregisterNodesRequest, nodesToUnregisterSize) - offsetof(UA_UnregisterNodesRequest, requestHeader) - sizeof(UA_RequestHeader),
8419  .isArray = true
8420  },};
8421 
8422 /* ContentFilterElementResult */
8423 static UA_DataTypeMember ContentFilterElementResult_members[3] = {
8425 #ifdef UA_ENABLE_TYPENAMES
8426  .memberName = "statusCode",
8427 #endif
8428  .namespaceZero = true,
8429  .padding = 0,
8430  .isArray = false
8431  },
8432  { .memberTypeIndex = UA_TYPES_STATUSCODE,
8433 #ifdef UA_ENABLE_TYPENAMES
8434  .memberName = "operandStatusCodes",
8435 #endif
8436  .namespaceZero = true,
8437  .padding = offsetof(UA_ContentFilterElementResult, operandStatusCodesSize) - offsetof(UA_ContentFilterElementResult, statusCode) - sizeof(UA_StatusCode),
8438  .isArray = true
8439  },
8440  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
8441 #ifdef UA_ENABLE_TYPENAMES
8442  .memberName = "operandDiagnosticInfos",
8443 #endif
8444  .namespaceZero = true,
8445  .padding = offsetof(UA_ContentFilterElementResult, operandDiagnosticInfosSize) - offsetof(UA_ContentFilterElementResult, operandStatusCodes) - sizeof(void*),
8446  .isArray = true
8447  },};
8448 
8449 /* QueryDataSet */
8450 static UA_DataTypeMember QueryDataSet_members[3] = {
8452 #ifdef UA_ENABLE_TYPENAMES
8453  .memberName = "nodeId",
8454 #endif
8455  .namespaceZero = true,
8456  .padding = 0,
8457  .isArray = false
8458  },
8459  { .memberTypeIndex = UA_TYPES_EXPANDEDNODEID,
8460 #ifdef UA_ENABLE_TYPENAMES
8461  .memberName = "typeDefinitionNode",
8462 #endif
8463  .namespaceZero = true,
8464  .padding = offsetof(UA_QueryDataSet, typeDefinitionNode) - offsetof(UA_QueryDataSet, nodeId) - sizeof(UA_ExpandedNodeId),
8465  .isArray = false
8466  },
8467  { .memberTypeIndex = UA_TYPES_VARIANT,
8468 #ifdef UA_ENABLE_TYPENAMES
8469  .memberName = "values",
8470 #endif
8471  .namespaceZero = true,
8472  .padding = offsetof(UA_QueryDataSet, valuesSize) - offsetof(UA_QueryDataSet, typeDefinitionNode) - sizeof(UA_ExpandedNodeId),
8473  .isArray = true
8474  },};
8475 
8476 /* AnonymousIdentityToken */
8477 static UA_DataTypeMember AnonymousIdentityToken_members[1] = {
8479 #ifdef UA_ENABLE_TYPENAMES
8480  .memberName = "policyId",
8481 #endif
8482  .namespaceZero = true,
8483  .padding = 0,
8484  .isArray = false
8485  },};
8486 
8487 /* SetPublishingModeRequest */
8488 static UA_DataTypeMember SetPublishingModeRequest_members[3] = {
8490 #ifdef UA_ENABLE_TYPENAMES
8491  .memberName = "requestHeader",
8492 #endif
8493  .namespaceZero = true,
8494  .padding = 0,
8495  .isArray = false
8496  },
8497  { .memberTypeIndex = UA_TYPES_BOOLEAN,
8498 #ifdef UA_ENABLE_TYPENAMES
8499  .memberName = "publishingEnabled",
8500 #endif
8501  .namespaceZero = true,
8502  .padding = offsetof(UA_SetPublishingModeRequest, publishingEnabled) - offsetof(UA_SetPublishingModeRequest, requestHeader) - sizeof(UA_RequestHeader),
8503  .isArray = false
8504  },
8505  { .memberTypeIndex = UA_TYPES_UINT32,
8506 #ifdef UA_ENABLE_TYPENAMES
8507  .memberName = "subscriptionIds",
8508 #endif
8509  .namespaceZero = true,
8510  .padding = offsetof(UA_SetPublishingModeRequest, subscriptionIdsSize) - offsetof(UA_SetPublishingModeRequest, publishingEnabled) - sizeof(UA_Boolean),
8511  .isArray = true
8512  },};
8513 
8514 /* TimestampsToReturn */
8515 static UA_DataTypeMember TimestampsToReturn_members[1] = {
8517 #ifdef UA_ENABLE_TYPENAMES
8518  .memberName = "",
8519 #endif
8520  .namespaceZero = true,
8521  .padding = 0,
8522  .isArray = false
8523  },};
8524 
8525 /* CallRequest */
8526 static UA_DataTypeMember CallRequest_members[2] = {
8528 #ifdef UA_ENABLE_TYPENAMES
8529  .memberName = "requestHeader",
8530 #endif
8531  .namespaceZero = true,
8532  .padding = 0,
8533  .isArray = false
8534  },
8535  { .memberTypeIndex = UA_TYPES_CALLMETHODREQUEST,
8536 #ifdef UA_ENABLE_TYPENAMES
8537  .memberName = "methodsToCall",
8538 #endif
8539  .namespaceZero = true,
8540  .padding = offsetof(UA_CallRequest, methodsToCallSize) - offsetof(UA_CallRequest, requestHeader) - sizeof(UA_RequestHeader),
8541  .isArray = true
8542  },};
8543 
8544 /* MethodAttributes */
8545 static UA_DataTypeMember MethodAttributes_members[7] = {
8547 #ifdef UA_ENABLE_TYPENAMES
8548  .memberName = "specifiedAttributes",
8549 #endif
8550  .namespaceZero = true,
8551  .padding = 0,
8552  .isArray = false
8553  },
8554  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
8555 #ifdef UA_ENABLE_TYPENAMES
8556  .memberName = "displayName",
8557 #endif
8558  .namespaceZero = true,
8559  .padding = offsetof(UA_MethodAttributes, displayName) - offsetof(UA_MethodAttributes, specifiedAttributes) - sizeof(UA_UInt32),
8560  .isArray = false
8561  },
8562  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
8563 #ifdef UA_ENABLE_TYPENAMES
8564  .memberName = "description",
8565 #endif
8566  .namespaceZero = true,
8567  .padding = offsetof(UA_MethodAttributes, description) - offsetof(UA_MethodAttributes, displayName) - sizeof(UA_LocalizedText),
8568  .isArray = false
8569  },
8570  { .memberTypeIndex = UA_TYPES_UINT32,
8571 #ifdef UA_ENABLE_TYPENAMES
8572  .memberName = "writeMask",
8573 #endif
8574  .namespaceZero = true,
8575  .padding = offsetof(UA_MethodAttributes, writeMask) - offsetof(UA_MethodAttributes, description) - sizeof(UA_LocalizedText),
8576  .isArray = false
8577  },
8578  { .memberTypeIndex = UA_TYPES_UINT32,
8579 #ifdef UA_ENABLE_TYPENAMES
8580  .memberName = "userWriteMask",
8581 #endif
8582  .namespaceZero = true,
8583  .padding = offsetof(UA_MethodAttributes, userWriteMask) - offsetof(UA_MethodAttributes, writeMask) - sizeof(UA_UInt32),
8584  .isArray = false
8585  },
8586  { .memberTypeIndex = UA_TYPES_BOOLEAN,
8587 #ifdef UA_ENABLE_TYPENAMES
8588  .memberName = "executable",
8589 #endif
8590  .namespaceZero = true,
8591  .padding = offsetof(UA_MethodAttributes, executable) - offsetof(UA_MethodAttributes, userWriteMask) - sizeof(UA_UInt32),
8592  .isArray = false
8593  },
8594  { .memberTypeIndex = UA_TYPES_BOOLEAN,
8595 #ifdef UA_ENABLE_TYPENAMES
8596  .memberName = "userExecutable",
8597 #endif
8598  .namespaceZero = true,
8599  .padding = offsetof(UA_MethodAttributes, userExecutable) - offsetof(UA_MethodAttributes, executable) - sizeof(UA_Boolean),
8600  .isArray = false
8601  },};
8602 
8603 /* DeleteReferencesItem */
8604 static UA_DataTypeMember DeleteReferencesItem_members[5] = {
8606 #ifdef UA_ENABLE_TYPENAMES
8607  .memberName = "sourceNodeId",
8608 #endif
8609  .namespaceZero = true,
8610  .padding = 0,
8611  .isArray = false
8612  },
8613  { .memberTypeIndex = UA_TYPES_NODEID,
8614 #ifdef UA_ENABLE_TYPENAMES
8615  .memberName = "referenceTypeId",
8616 #endif
8617  .namespaceZero = true,
8618  .padding = offsetof(UA_DeleteReferencesItem, referenceTypeId) - offsetof(UA_DeleteReferencesItem, sourceNodeId) - sizeof(UA_NodeId),
8619  .isArray = false
8620  },
8621  { .memberTypeIndex = UA_TYPES_BOOLEAN,
8622 #ifdef UA_ENABLE_TYPENAMES
8623  .memberName = "isForward",
8624 #endif
8625  .namespaceZero = true,
8626  .padding = offsetof(UA_DeleteReferencesItem, isForward) - offsetof(UA_DeleteReferencesItem, referenceTypeId) - sizeof(UA_NodeId),
8627  .isArray = false
8628  },
8629  { .memberTypeIndex = UA_TYPES_EXPANDEDNODEID,
8630 #ifdef UA_ENABLE_TYPENAMES
8631  .memberName = "targetNodeId",
8632 #endif
8633  .namespaceZero = true,
8634  .padding = offsetof(UA_DeleteReferencesItem, targetNodeId) - offsetof(UA_DeleteReferencesItem, isForward) - sizeof(UA_Boolean),
8635  .isArray = false
8636  },
8637  { .memberTypeIndex = UA_TYPES_BOOLEAN,
8638 #ifdef UA_ENABLE_TYPENAMES
8639  .memberName = "deleteBidirectional",
8640 #endif
8641  .namespaceZero = true,
8642  .padding = offsetof(UA_DeleteReferencesItem, deleteBidirectional) - offsetof(UA_DeleteReferencesItem, targetNodeId) - sizeof(UA_ExpandedNodeId),
8643  .isArray = false
8644  },};
8645 
8646 /* WriteValue */
8647 static UA_DataTypeMember WriteValue_members[4] = {
8649 #ifdef UA_ENABLE_TYPENAMES
8650  .memberName = "nodeId",
8651 #endif
8652  .namespaceZero = true,
8653  .padding = 0,
8654  .isArray = false
8655  },
8656  { .memberTypeIndex = UA_TYPES_UINT32,
8657 #ifdef UA_ENABLE_TYPENAMES
8658  .memberName = "attributeId",
8659 #endif
8660  .namespaceZero = true,
8661  .padding = offsetof(UA_WriteValue, attributeId) - offsetof(UA_WriteValue, nodeId) - sizeof(UA_NodeId),
8662  .isArray = false
8663  },
8664  { .memberTypeIndex = UA_TYPES_STRING,
8665 #ifdef UA_ENABLE_TYPENAMES
8666  .memberName = "indexRange",
8667 #endif
8668  .namespaceZero = true,
8669  .padding = offsetof(UA_WriteValue, indexRange) - offsetof(UA_WriteValue, attributeId) - sizeof(UA_UInt32),
8670  .isArray = false
8671  },
8672  { .memberTypeIndex = UA_TYPES_DATAVALUE,
8673 #ifdef UA_ENABLE_TYPENAMES
8674  .memberName = "value",
8675 #endif
8676  .namespaceZero = true,
8677  .padding = offsetof(UA_WriteValue, value) - offsetof(UA_WriteValue, indexRange) - sizeof(UA_String),
8678  .isArray = false
8679  },};
8680 
8681 /* MonitoredItemCreateResult */
8682 static UA_DataTypeMember MonitoredItemCreateResult_members[5] = {
8684 #ifdef UA_ENABLE_TYPENAMES
8685  .memberName = "statusCode",
8686 #endif
8687  .namespaceZero = true,
8688  .padding = 0,
8689  .isArray = false
8690  },
8691  { .memberTypeIndex = UA_TYPES_UINT32,
8692 #ifdef UA_ENABLE_TYPENAMES
8693  .memberName = "monitoredItemId",
8694 #endif
8695  .namespaceZero = true,
8696  .padding = offsetof(UA_MonitoredItemCreateResult, monitoredItemId) - offsetof(UA_MonitoredItemCreateResult, statusCode) - sizeof(UA_StatusCode),
8697  .isArray = false
8698  },
8699  { .memberTypeIndex = UA_TYPES_DOUBLE,
8700 #ifdef UA_ENABLE_TYPENAMES
8701  .memberName = "revisedSamplingInterval",
8702 #endif
8703  .namespaceZero = true,
8704  .padding = offsetof(UA_MonitoredItemCreateResult, revisedSamplingInterval) - offsetof(UA_MonitoredItemCreateResult, monitoredItemId) - sizeof(UA_UInt32),
8705  .isArray = false
8706  },
8707  { .memberTypeIndex = UA_TYPES_UINT32,
8708 #ifdef UA_ENABLE_TYPENAMES
8709  .memberName = "revisedQueueSize",
8710 #endif
8711  .namespaceZero = true,
8712  .padding = offsetof(UA_MonitoredItemCreateResult, revisedQueueSize) - offsetof(UA_MonitoredItemCreateResult, revisedSamplingInterval) - sizeof(UA_Double),
8713  .isArray = false
8714  },
8715  { .memberTypeIndex = UA_TYPES_EXTENSIONOBJECT,
8716 #ifdef UA_ENABLE_TYPENAMES
8717  .memberName = "filterResult",
8718 #endif
8719  .namespaceZero = true,
8720  .padding = offsetof(UA_MonitoredItemCreateResult, filterResult) - offsetof(UA_MonitoredItemCreateResult, revisedQueueSize) - sizeof(UA_UInt32),
8721  .isArray = false
8722  },};
8723 
8724 /* MessageSecurityMode */
8725 static UA_DataTypeMember MessageSecurityMode_members[1] = {
8727 #ifdef UA_ENABLE_TYPENAMES
8728  .memberName = "",
8729 #endif
8730  .namespaceZero = true,
8731  .padding = 0,
8732  .isArray = false
8733  },};
8734 
8735 /* MonitoringParameters */
8736 static UA_DataTypeMember MonitoringParameters_members[5] = {
8738 #ifdef UA_ENABLE_TYPENAMES
8739  .memberName = "clientHandle",
8740 #endif
8741  .namespaceZero = true,
8742  .padding = 0,
8743  .isArray = false
8744  },
8745  { .memberTypeIndex = UA_TYPES_DOUBLE,
8746 #ifdef UA_ENABLE_TYPENAMES
8747  .memberName = "samplingInterval",
8748 #endif
8749  .namespaceZero = true,
8750  .padding = offsetof(UA_MonitoringParameters, samplingInterval) - offsetof(UA_MonitoringParameters, clientHandle) - sizeof(UA_UInt32),
8751  .isArray = false
8752  },
8753  { .memberTypeIndex = UA_TYPES_EXTENSIONOBJECT,
8754 #ifdef UA_ENABLE_TYPENAMES
8755  .memberName = "filter",
8756 #endif
8757  .namespaceZero = true,
8758  .padding = offsetof(UA_MonitoringParameters, filter) - offsetof(UA_MonitoringParameters, samplingInterval) - sizeof(UA_Double),
8759  .isArray = false
8760  },
8761  { .memberTypeIndex = UA_TYPES_UINT32,
8762 #ifdef UA_ENABLE_TYPENAMES
8763  .memberName = "queueSize",
8764 #endif
8765  .namespaceZero = true,
8766  .padding = offsetof(UA_MonitoringParameters, queueSize) - offsetof(UA_MonitoringParameters, filter) - sizeof(UA_ExtensionObject),
8767  .isArray = false
8768  },
8769  { .memberTypeIndex = UA_TYPES_BOOLEAN,
8770 #ifdef UA_ENABLE_TYPENAMES
8771  .memberName = "discardOldest",
8772 #endif
8773  .namespaceZero = true,
8774  .padding = offsetof(UA_MonitoringParameters, discardOldest) - offsetof(UA_MonitoringParameters, queueSize) - sizeof(UA_UInt32),
8775  .isArray = false
8776  },};
8777 
8778 /* SignatureData */
8779 static UA_DataTypeMember SignatureData_members[2] = {
8781 #ifdef UA_ENABLE_TYPENAMES
8782  .memberName = "algorithm",
8783 #endif
8784  .namespaceZero = true,
8785  .padding = 0,
8786  .isArray = false
8787  },
8788  { .memberTypeIndex = UA_TYPES_BYTESTRING,
8789 #ifdef UA_ENABLE_TYPENAMES
8790  .memberName = "signature",
8791 #endif
8792  .namespaceZero = true,
8793  .padding = offsetof(UA_SignatureData, signature) - offsetof(UA_SignatureData, algorithm) - sizeof(UA_String),
8794  .isArray = false
8795  },};
8796 
8797 /* ReferenceNode */
8798 static UA_DataTypeMember ReferenceNode_members[3] = {
8800 #ifdef UA_ENABLE_TYPENAMES
8801  .memberName = "referenceTypeId",
8802 #endif
8803  .namespaceZero = true,
8804  .padding = 0,
8805  .isArray = false
8806  },
8807  { .memberTypeIndex = UA_TYPES_BOOLEAN,
8808 #ifdef UA_ENABLE_TYPENAMES
8809  .memberName = "isInverse",
8810 #endif
8811  .namespaceZero = true,
8812  .padding = offsetof(UA_ReferenceNode, isInverse) - offsetof(UA_ReferenceNode, referenceTypeId) - sizeof(UA_NodeId),
8813  .isArray = false
8814  },
8815  { .memberTypeIndex = UA_TYPES_EXPANDEDNODEID,
8816 #ifdef UA_ENABLE_TYPENAMES
8817  .memberName = "targetId",
8818 #endif
8819  .namespaceZero = true,
8820  .padding = offsetof(UA_ReferenceNode, targetId) - offsetof(UA_ReferenceNode, isInverse) - sizeof(UA_Boolean),
8821  .isArray = false
8822  },};
8823 
8824 /* Argument */
8825 static UA_DataTypeMember Argument_members[5] = {
8827 #ifdef UA_ENABLE_TYPENAMES
8828  .memberName = "name",
8829 #endif
8830  .namespaceZero = true,
8831  .padding = 0,
8832  .isArray = false
8833  },
8834  { .memberTypeIndex = UA_TYPES_NODEID,
8835 #ifdef UA_ENABLE_TYPENAMES
8836  .memberName = "dataType",
8837 #endif
8838  .namespaceZero = true,
8839  .padding = offsetof(UA_Argument, dataType) - offsetof(UA_Argument, name) - sizeof(UA_String),
8840  .isArray = false
8841  },
8842  { .memberTypeIndex = UA_TYPES_INT32,
8843 #ifdef UA_ENABLE_TYPENAMES
8844  .memberName = "valueRank",
8845 #endif
8846  .namespaceZero = true,
8847  .padding = offsetof(UA_Argument, valueRank) - offsetof(UA_Argument, dataType) - sizeof(UA_NodeId),
8848  .isArray = false
8849  },
8850  { .memberTypeIndex = UA_TYPES_UINT32,
8851 #ifdef UA_ENABLE_TYPENAMES
8852  .memberName = "arrayDimensions",
8853 #endif
8854  .namespaceZero = true,
8855  .padding = offsetof(UA_Argument, arrayDimensionsSize) - offsetof(UA_Argument, valueRank) - sizeof(UA_Int32),
8856  .isArray = true
8857  },
8858  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
8859 #ifdef UA_ENABLE_TYPENAMES
8860  .memberName = "description",
8861 #endif
8862  .namespaceZero = true,
8863  .padding = offsetof(UA_Argument, description) - offsetof(UA_Argument, arrayDimensions) - sizeof(void*),
8864  .isArray = false
8865  },};
8866 
8867 /* UserIdentityToken */
8868 static UA_DataTypeMember UserIdentityToken_members[1] = {
8870 #ifdef UA_ENABLE_TYPENAMES
8871  .memberName = "policyId",
8872 #endif
8873  .namespaceZero = true,
8874  .padding = 0,
8875  .isArray = false
8876  },};
8877 
8878 /* ObjectTypeAttributes */
8879 static UA_DataTypeMember ObjectTypeAttributes_members[6] = {
8881 #ifdef UA_ENABLE_TYPENAMES
8882  .memberName = "specifiedAttributes",
8883 #endif
8884  .namespaceZero = true,
8885  .padding = 0,
8886  .isArray = false
8887  },
8888  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
8889 #ifdef UA_ENABLE_TYPENAMES
8890  .memberName = "displayName",
8891 #endif
8892  .namespaceZero = true,
8893  .padding = offsetof(UA_ObjectTypeAttributes, displayName) - offsetof(UA_ObjectTypeAttributes, specifiedAttributes) - sizeof(UA_UInt32),
8894  .isArray = false
8895  },
8896  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
8897 #ifdef UA_ENABLE_TYPENAMES
8898  .memberName = "description",
8899 #endif
8900  .namespaceZero = true,
8901  .padding = offsetof(UA_ObjectTypeAttributes, description) - offsetof(UA_ObjectTypeAttributes, displayName) - sizeof(UA_LocalizedText),
8902  .isArray = false
8903  },
8904  { .memberTypeIndex = UA_TYPES_UINT32,
8905 #ifdef UA_ENABLE_TYPENAMES
8906  .memberName = "writeMask",
8907 #endif
8908  .namespaceZero = true,
8909  .padding = offsetof(UA_ObjectTypeAttributes, writeMask) - offsetof(UA_ObjectTypeAttributes, description) - sizeof(UA_LocalizedText),
8910  .isArray = false
8911  },
8912  { .memberTypeIndex = UA_TYPES_UINT32,
8913 #ifdef UA_ENABLE_TYPENAMES
8914  .memberName = "userWriteMask",
8915 #endif
8916  .namespaceZero = true,
8917  .padding = offsetof(UA_ObjectTypeAttributes, userWriteMask) - offsetof(UA_ObjectTypeAttributes, writeMask) - sizeof(UA_UInt32),
8918  .isArray = false
8919  },
8920  { .memberTypeIndex = UA_TYPES_BOOLEAN,
8921 #ifdef UA_ENABLE_TYPENAMES
8922  .memberName = "isAbstract",
8923 #endif
8924  .namespaceZero = true,
8925  .padding = offsetof(UA_ObjectTypeAttributes, isAbstract) - offsetof(UA_ObjectTypeAttributes, userWriteMask) - sizeof(UA_UInt32),
8926  .isArray = false
8927  },};
8928 
8929 /* DeadbandType */
8930 static UA_DataTypeMember DeadbandType_members[1] = {
8932 #ifdef UA_ENABLE_TYPENAMES
8933  .memberName = "",
8934 #endif
8935  .namespaceZero = true,
8936  .padding = 0,
8937  .isArray = false
8938  },};
8939 
8940 /* SecurityTokenRequestType */
8941 static UA_DataTypeMember SecurityTokenRequestType_members[1] = {
8943 #ifdef UA_ENABLE_TYPENAMES
8944  .memberName = "",
8945 #endif
8946  .namespaceZero = true,
8947  .padding = 0,
8948  .isArray = false
8949  },};
8950 
8951 /* DataChangeTrigger */
8952 static UA_DataTypeMember DataChangeTrigger_members[1] = {
8954 #ifdef UA_ENABLE_TYPENAMES
8955  .memberName = "",
8956 #endif
8957  .namespaceZero = true,
8958  .padding = 0,
8959  .isArray = false
8960  },};
8961 
8962 /* BuildInfo */
8963 static UA_DataTypeMember BuildInfo_members[6] = {
8965 #ifdef UA_ENABLE_TYPENAMES
8966  .memberName = "productUri",
8967 #endif
8968  .namespaceZero = true,
8969  .padding = 0,
8970  .isArray = false
8971  },
8972  { .memberTypeIndex = UA_TYPES_STRING,
8973 #ifdef UA_ENABLE_TYPENAMES
8974  .memberName = "manufacturerName",
8975 #endif
8976  .namespaceZero = true,
8977  .padding = offsetof(UA_BuildInfo, manufacturerName) - offsetof(UA_BuildInfo, productUri) - sizeof(UA_String),
8978  .isArray = false
8979  },
8980  { .memberTypeIndex = UA_TYPES_STRING,
8981 #ifdef UA_ENABLE_TYPENAMES
8982  .memberName = "productName",
8983 #endif
8984  .namespaceZero = true,
8985  .padding = offsetof(UA_BuildInfo, productName) - offsetof(UA_BuildInfo, manufacturerName) - sizeof(UA_String),
8986  .isArray = false
8987  },
8988  { .memberTypeIndex = UA_TYPES_STRING,
8989 #ifdef UA_ENABLE_TYPENAMES
8990  .memberName = "softwareVersion",
8991 #endif
8992  .namespaceZero = true,
8993  .padding = offsetof(UA_BuildInfo, softwareVersion) - offsetof(UA_BuildInfo, productName) - sizeof(UA_String),
8994  .isArray = false
8995  },
8996  { .memberTypeIndex = UA_TYPES_STRING,
8997 #ifdef UA_ENABLE_TYPENAMES
8998  .memberName = "buildNumber",
8999 #endif
9000  .namespaceZero = true,
9001  .padding = offsetof(UA_BuildInfo, buildNumber) - offsetof(UA_BuildInfo, softwareVersion) - sizeof(UA_String),
9002  .isArray = false
9003  },
9004  { .memberTypeIndex = UA_TYPES_DATETIME,
9005 #ifdef UA_ENABLE_TYPENAMES
9006  .memberName = "buildDate",
9007 #endif
9008  .namespaceZero = true,
9009  .padding = offsetof(UA_BuildInfo, buildDate) - offsetof(UA_BuildInfo, buildNumber) - sizeof(UA_String),
9010  .isArray = false
9011  },};
9012 
9013 /* NodeClass */
9014 static UA_DataTypeMember NodeClass_members[1] = {
9016 #ifdef UA_ENABLE_TYPENAMES
9017  .memberName = "",
9018 #endif
9019  .namespaceZero = true,
9020  .padding = 0,
9021  .isArray = false
9022  },};
9023 
9024 /* ChannelSecurityToken */
9025 static UA_DataTypeMember ChannelSecurityToken_members[4] = {
9027 #ifdef UA_ENABLE_TYPENAMES
9028  .memberName = "channelId",
9029 #endif
9030  .namespaceZero = true,
9031  .padding = 0,
9032  .isArray = false
9033  },
9034  { .memberTypeIndex = UA_TYPES_UINT32,
9035 #ifdef UA_ENABLE_TYPENAMES
9036  .memberName = "tokenId",
9037 #endif
9038  .namespaceZero = true,
9039  .padding = offsetof(UA_ChannelSecurityToken, tokenId) - offsetof(UA_ChannelSecurityToken, channelId) - sizeof(UA_UInt32),
9040  .isArray = false
9041  },
9042  { .memberTypeIndex = UA_TYPES_DATETIME,
9043 #ifdef UA_ENABLE_TYPENAMES
9044  .memberName = "createdAt",
9045 #endif
9046  .namespaceZero = true,
9047  .padding = offsetof(UA_ChannelSecurityToken, createdAt) - offsetof(UA_ChannelSecurityToken, tokenId) - sizeof(UA_UInt32),
9048  .isArray = false
9049  },
9050  { .memberTypeIndex = UA_TYPES_UINT32,
9051 #ifdef UA_ENABLE_TYPENAMES
9052  .memberName = "revisedLifetime",
9053 #endif
9054  .namespaceZero = true,
9055  .padding = offsetof(UA_ChannelSecurityToken, revisedLifetime) - offsetof(UA_ChannelSecurityToken, createdAt) - sizeof(UA_DateTime),
9056  .isArray = false
9057  },};
9058 
9059 /* MonitoredItemNotification */
9060 static UA_DataTypeMember MonitoredItemNotification_members[2] = {
9062 #ifdef UA_ENABLE_TYPENAMES
9063  .memberName = "clientHandle",
9064 #endif
9065  .namespaceZero = true,
9066  .padding = 0,
9067  .isArray = false
9068  },
9069  { .memberTypeIndex = UA_TYPES_DATAVALUE,
9070 #ifdef UA_ENABLE_TYPENAMES
9071  .memberName = "value",
9072 #endif
9073  .namespaceZero = true,
9074  .padding = offsetof(UA_MonitoredItemNotification, value) - offsetof(UA_MonitoredItemNotification, clientHandle) - sizeof(UA_UInt32),
9075  .isArray = false
9076  },};
9077 
9078 /* DeleteNodesItem */
9079 static UA_DataTypeMember DeleteNodesItem_members[2] = {
9081 #ifdef UA_ENABLE_TYPENAMES
9082  .memberName = "nodeId",
9083 #endif
9084  .namespaceZero = true,
9085  .padding = 0,
9086  .isArray = false
9087  },
9088  { .memberTypeIndex = UA_TYPES_BOOLEAN,
9089 #ifdef UA_ENABLE_TYPENAMES
9090  .memberName = "deleteTargetReferences",
9091 #endif
9092  .namespaceZero = true,
9093  .padding = offsetof(UA_DeleteNodesItem, deleteTargetReferences) - offsetof(UA_DeleteNodesItem, nodeId) - sizeof(UA_NodeId),
9094  .isArray = false
9095  },};
9096 
9097 /* SubscriptionAcknowledgement */
9098 static UA_DataTypeMember SubscriptionAcknowledgement_members[2] = {
9100 #ifdef UA_ENABLE_TYPENAMES
9101  .memberName = "subscriptionId",
9102 #endif
9103  .namespaceZero = true,
9104  .padding = 0,
9105  .isArray = false
9106  },
9107  { .memberTypeIndex = UA_TYPES_UINT32,
9108 #ifdef UA_ENABLE_TYPENAMES
9109  .memberName = "sequenceNumber",
9110 #endif
9111  .namespaceZero = true,
9112  .padding = offsetof(UA_SubscriptionAcknowledgement, sequenceNumber) - offsetof(UA_SubscriptionAcknowledgement, subscriptionId) - sizeof(UA_UInt32),
9113  .isArray = false
9114  },};
9115 
9116 /* ReadValueId */
9117 static UA_DataTypeMember ReadValueId_members[4] = {
9119 #ifdef UA_ENABLE_TYPENAMES
9120  .memberName = "nodeId",
9121 #endif
9122  .namespaceZero = true,
9123  .padding = 0,
9124  .isArray = false
9125  },
9126  { .memberTypeIndex = UA_TYPES_UINT32,
9127 #ifdef UA_ENABLE_TYPENAMES
9128  .memberName = "attributeId",
9129 #endif
9130  .namespaceZero = true,
9131  .padding = offsetof(UA_ReadValueId, attributeId) - offsetof(UA_ReadValueId, nodeId) - sizeof(UA_NodeId),
9132  .isArray = false
9133  },
9134  { .memberTypeIndex = UA_TYPES_STRING,
9135 #ifdef UA_ENABLE_TYPENAMES
9136  .memberName = "indexRange",
9137 #endif
9138  .namespaceZero = true,
9139  .padding = offsetof(UA_ReadValueId, indexRange) - offsetof(UA_ReadValueId, attributeId) - sizeof(UA_UInt32),
9140  .isArray = false
9141  },
9142  { .memberTypeIndex = UA_TYPES_QUALIFIEDNAME,
9143 #ifdef UA_ENABLE_TYPENAMES
9144  .memberName = "dataEncoding",
9145 #endif
9146  .namespaceZero = true,
9147  .padding = offsetof(UA_ReadValueId, dataEncoding) - offsetof(UA_ReadValueId, indexRange) - sizeof(UA_String),
9148  .isArray = false
9149  },};
9150 
9151 /* DataTypeAttributes */
9152 static UA_DataTypeMember DataTypeAttributes_members[6] = {
9154 #ifdef UA_ENABLE_TYPENAMES
9155  .memberName = "specifiedAttributes",
9156 #endif
9157  .namespaceZero = true,
9158  .padding = 0,
9159  .isArray = false
9160  },
9161  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
9162 #ifdef UA_ENABLE_TYPENAMES
9163  .memberName = "displayName",
9164 #endif
9165  .namespaceZero = true,
9166  .padding = offsetof(UA_DataTypeAttributes, displayName) - offsetof(UA_DataTypeAttributes, specifiedAttributes) - sizeof(UA_UInt32),
9167  .isArray = false
9168  },
9169  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
9170 #ifdef UA_ENABLE_TYPENAMES
9171  .memberName = "description",
9172 #endif
9173  .namespaceZero = true,
9174  .padding = offsetof(UA_DataTypeAttributes, description) - offsetof(UA_DataTypeAttributes, displayName) - sizeof(UA_LocalizedText),
9175  .isArray = false
9176  },
9177  { .memberTypeIndex = UA_TYPES_UINT32,
9178 #ifdef UA_ENABLE_TYPENAMES
9179  .memberName = "writeMask",
9180 #endif
9181  .namespaceZero = true,
9182  .padding = offsetof(UA_DataTypeAttributes, writeMask) - offsetof(UA_DataTypeAttributes, description) - sizeof(UA_LocalizedText),
9183  .isArray = false
9184  },
9185  { .memberTypeIndex = UA_TYPES_UINT32,
9186 #ifdef UA_ENABLE_TYPENAMES
9187  .memberName = "userWriteMask",
9188 #endif
9189  .namespaceZero = true,
9190  .padding = offsetof(UA_DataTypeAttributes, userWriteMask) - offsetof(UA_DataTypeAttributes, writeMask) - sizeof(UA_UInt32),
9191  .isArray = false
9192  },
9193  { .memberTypeIndex = UA_TYPES_BOOLEAN,
9194 #ifdef UA_ENABLE_TYPENAMES
9195  .memberName = "isAbstract",
9196 #endif
9197  .namespaceZero = true,
9198  .padding = offsetof(UA_DataTypeAttributes, isAbstract) - offsetof(UA_DataTypeAttributes, userWriteMask) - sizeof(UA_UInt32),
9199  .isArray = false
9200  },};
9201 
9202 /* ResponseHeader */
9203 static UA_DataTypeMember ResponseHeader_members[6] = {
9205 #ifdef UA_ENABLE_TYPENAMES
9206  .memberName = "timestamp",
9207 #endif
9208  .namespaceZero = true,
9209  .padding = 0,
9210  .isArray = false
9211  },
9212  { .memberTypeIndex = UA_TYPES_UINT32,
9213 #ifdef UA_ENABLE_TYPENAMES
9214  .memberName = "requestHandle",
9215 #endif
9216  .namespaceZero = true,
9217  .padding = offsetof(UA_ResponseHeader, requestHandle) - offsetof(UA_ResponseHeader, timestamp) - sizeof(UA_DateTime),
9218  .isArray = false
9219  },
9220  { .memberTypeIndex = UA_TYPES_STATUSCODE,
9221 #ifdef UA_ENABLE_TYPENAMES
9222  .memberName = "serviceResult",
9223 #endif
9224  .namespaceZero = true,
9225  .padding = offsetof(UA_ResponseHeader, serviceResult) - offsetof(UA_ResponseHeader, requestHandle) - sizeof(UA_UInt32),
9226  .isArray = false
9227  },
9228  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
9229 #ifdef UA_ENABLE_TYPENAMES
9230  .memberName = "serviceDiagnostics",
9231 #endif
9232  .namespaceZero = true,
9233  .padding = offsetof(UA_ResponseHeader, serviceDiagnostics) - offsetof(UA_ResponseHeader, serviceResult) - sizeof(UA_StatusCode),
9234  .isArray = false
9235  },
9236  { .memberTypeIndex = UA_TYPES_STRING,
9237 #ifdef UA_ENABLE_TYPENAMES
9238  .memberName = "stringTable",
9239 #endif
9240  .namespaceZero = true,
9241  .padding = offsetof(UA_ResponseHeader, stringTableSize) - offsetof(UA_ResponseHeader, serviceDiagnostics) - sizeof(UA_DiagnosticInfo),
9242  .isArray = true
9243  },
9244  { .memberTypeIndex = UA_TYPES_EXTENSIONOBJECT,
9245 #ifdef UA_ENABLE_TYPENAMES
9246  .memberName = "additionalHeader",
9247 #endif
9248  .namespaceZero = true,
9249  .padding = offsetof(UA_ResponseHeader, additionalHeader) - offsetof(UA_ResponseHeader, stringTable) - sizeof(void*),
9250  .isArray = false
9251  },};
9252 
9253 /* DeleteSubscriptionsRequest */
9254 static UA_DataTypeMember DeleteSubscriptionsRequest_members[2] = {
9256 #ifdef UA_ENABLE_TYPENAMES
9257  .memberName = "requestHeader",
9258 #endif
9259  .namespaceZero = true,
9260  .padding = 0,
9261  .isArray = false
9262  },
9263  { .memberTypeIndex = UA_TYPES_UINT32,
9264 #ifdef UA_ENABLE_TYPENAMES
9265  .memberName = "subscriptionIds",
9266 #endif
9267  .namespaceZero = true,
9268  .padding = offsetof(UA_DeleteSubscriptionsRequest, subscriptionIdsSize) - offsetof(UA_DeleteSubscriptionsRequest, requestHeader) - sizeof(UA_RequestHeader),
9269  .isArray = true
9270  },};
9271 
9272 /* ViewDescription */
9273 static UA_DataTypeMember ViewDescription_members[3] = {
9275 #ifdef UA_ENABLE_TYPENAMES
9276  .memberName = "viewId",
9277 #endif
9278  .namespaceZero = true,
9279  .padding = 0,
9280  .isArray = false
9281  },
9282  { .memberTypeIndex = UA_TYPES_DATETIME,
9283 #ifdef UA_ENABLE_TYPENAMES
9284  .memberName = "timestamp",
9285 #endif
9286  .namespaceZero = true,
9287  .padding = offsetof(UA_ViewDescription, timestamp) - offsetof(UA_ViewDescription, viewId) - sizeof(UA_NodeId),
9288  .isArray = false
9289  },
9290  { .memberTypeIndex = UA_TYPES_UINT32,
9291 #ifdef UA_ENABLE_TYPENAMES
9292  .memberName = "viewVersion",
9293 #endif
9294  .namespaceZero = true,
9295  .padding = offsetof(UA_ViewDescription, viewVersion) - offsetof(UA_ViewDescription, timestamp) - sizeof(UA_DateTime),
9296  .isArray = false
9297  },};
9298 
9299 /* DeleteMonitoredItemsResponse */
9300 static UA_DataTypeMember DeleteMonitoredItemsResponse_members[3] = {
9302 #ifdef UA_ENABLE_TYPENAMES
9303  .memberName = "responseHeader",
9304 #endif
9305  .namespaceZero = true,
9306  .padding = 0,
9307  .isArray = false
9308  },
9309  { .memberTypeIndex = UA_TYPES_STATUSCODE,
9310 #ifdef UA_ENABLE_TYPENAMES
9311  .memberName = "results",
9312 #endif
9313  .namespaceZero = true,
9314  .padding = offsetof(UA_DeleteMonitoredItemsResponse, resultsSize) - offsetof(UA_DeleteMonitoredItemsResponse, responseHeader) - sizeof(UA_ResponseHeader),
9315  .isArray = true
9316  },
9317  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
9318 #ifdef UA_ENABLE_TYPENAMES
9319  .memberName = "diagnosticInfos",
9320 #endif
9321  .namespaceZero = true,
9322  .padding = offsetof(UA_DeleteMonitoredItemsResponse, diagnosticInfosSize) - offsetof(UA_DeleteMonitoredItemsResponse, results) - sizeof(void*),
9323  .isArray = true
9324  },};
9325 
9326 /* NodeAttributes */
9327 static UA_DataTypeMember NodeAttributes_members[5] = {
9329 #ifdef UA_ENABLE_TYPENAMES
9330  .memberName = "specifiedAttributes",
9331 #endif
9332  .namespaceZero = true,
9333  .padding = 0,
9334  .isArray = false
9335  },
9336  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
9337 #ifdef UA_ENABLE_TYPENAMES
9338  .memberName = "displayName",
9339 #endif
9340  .namespaceZero = true,
9341  .padding = offsetof(UA_NodeAttributes, displayName) - offsetof(UA_NodeAttributes, specifiedAttributes) - sizeof(UA_UInt32),
9342  .isArray = false
9343  },
9344  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
9345 #ifdef UA_ENABLE_TYPENAMES
9346  .memberName = "description",
9347 #endif
9348  .namespaceZero = true,
9349  .padding = offsetof(UA_NodeAttributes, description) - offsetof(UA_NodeAttributes, displayName) - sizeof(UA_LocalizedText),
9350  .isArray = false
9351  },
9352  { .memberTypeIndex = UA_TYPES_UINT32,
9353 #ifdef UA_ENABLE_TYPENAMES
9354  .memberName = "writeMask",
9355 #endif
9356  .namespaceZero = true,
9357  .padding = offsetof(UA_NodeAttributes, writeMask) - offsetof(UA_NodeAttributes, description) - sizeof(UA_LocalizedText),
9358  .isArray = false
9359  },
9360  { .memberTypeIndex = UA_TYPES_UINT32,
9361 #ifdef UA_ENABLE_TYPENAMES
9362  .memberName = "userWriteMask",
9363 #endif
9364  .namespaceZero = true,
9365  .padding = offsetof(UA_NodeAttributes, userWriteMask) - offsetof(UA_NodeAttributes, writeMask) - sizeof(UA_UInt32),
9366  .isArray = false
9367  },};
9368 
9369 /* RegisterNodesRequest */
9370 static UA_DataTypeMember RegisterNodesRequest_members[2] = {
9372 #ifdef UA_ENABLE_TYPENAMES
9373  .memberName = "requestHeader",
9374 #endif
9375  .namespaceZero = true,
9376  .padding = 0,
9377  .isArray = false
9378  },
9379  { .memberTypeIndex = UA_TYPES_NODEID,
9380 #ifdef UA_ENABLE_TYPENAMES
9381  .memberName = "nodesToRegister",
9382 #endif
9383  .namespaceZero = true,
9384  .padding = offsetof(UA_RegisterNodesRequest, nodesToRegisterSize) - offsetof(UA_RegisterNodesRequest, requestHeader) - sizeof(UA_RequestHeader),
9385  .isArray = true
9386  },};
9387 
9388 /* DeleteNodesRequest */
9389 static UA_DataTypeMember DeleteNodesRequest_members[2] = {
9391 #ifdef UA_ENABLE_TYPENAMES
9392  .memberName = "requestHeader",
9393 #endif
9394  .namespaceZero = true,
9395  .padding = 0,
9396  .isArray = false
9397  },
9398  { .memberTypeIndex = UA_TYPES_DELETENODESITEM,
9399 #ifdef UA_ENABLE_TYPENAMES
9400  .memberName = "nodesToDelete",
9401 #endif
9402  .namespaceZero = true,
9403  .padding = offsetof(UA_DeleteNodesRequest, nodesToDeleteSize) - offsetof(UA_DeleteNodesRequest, requestHeader) - sizeof(UA_RequestHeader),
9404  .isArray = true
9405  },};
9406 
9407 /* PublishResponse */
9408 static UA_DataTypeMember PublishResponse_members[7] = {
9410 #ifdef UA_ENABLE_TYPENAMES
9411  .memberName = "responseHeader",
9412 #endif
9413  .namespaceZero = true,
9414  .padding = 0,
9415  .isArray = false
9416  },
9417  { .memberTypeIndex = UA_TYPES_UINT32,
9418 #ifdef UA_ENABLE_TYPENAMES
9419  .memberName = "subscriptionId",
9420 #endif
9421  .namespaceZero = true,
9422  .padding = offsetof(UA_PublishResponse, subscriptionId) - offsetof(UA_PublishResponse, responseHeader) - sizeof(UA_ResponseHeader),
9423  .isArray = false
9424  },
9425  { .memberTypeIndex = UA_TYPES_UINT32,
9426 #ifdef UA_ENABLE_TYPENAMES
9427  .memberName = "availableSequenceNumbers",
9428 #endif
9429  .namespaceZero = true,
9430  .padding = offsetof(UA_PublishResponse, availableSequenceNumbersSize) - offsetof(UA_PublishResponse, subscriptionId) - sizeof(UA_UInt32),
9431  .isArray = true
9432  },
9433  { .memberTypeIndex = UA_TYPES_BOOLEAN,
9434 #ifdef UA_ENABLE_TYPENAMES
9435  .memberName = "moreNotifications",
9436 #endif
9437  .namespaceZero = true,
9438  .padding = offsetof(UA_PublishResponse, moreNotifications) - offsetof(UA_PublishResponse, availableSequenceNumbers) - sizeof(void*),
9439  .isArray = false
9440  },
9441  { .memberTypeIndex = UA_TYPES_NOTIFICATIONMESSAGE,
9442 #ifdef UA_ENABLE_TYPENAMES
9443  .memberName = "notificationMessage",
9444 #endif
9445  .namespaceZero = true,
9446  .padding = offsetof(UA_PublishResponse, notificationMessage) - offsetof(UA_PublishResponse, moreNotifications) - sizeof(UA_Boolean),
9447  .isArray = false
9448  },
9449  { .memberTypeIndex = UA_TYPES_STATUSCODE,
9450 #ifdef UA_ENABLE_TYPENAMES
9451  .memberName = "results",
9452 #endif
9453  .namespaceZero = true,
9454  .padding = offsetof(UA_PublishResponse, resultsSize) - offsetof(UA_PublishResponse, notificationMessage) - sizeof(UA_NotificationMessage),
9455  .isArray = true
9456  },
9457  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
9458 #ifdef UA_ENABLE_TYPENAMES
9459  .memberName = "diagnosticInfos",
9460 #endif
9461  .namespaceZero = true,
9462  .padding = offsetof(UA_PublishResponse, diagnosticInfosSize) - offsetof(UA_PublishResponse, results) - sizeof(void*),
9463  .isArray = true
9464  },};
9465 
9466 /* MonitoredItemModifyRequest */
9467 static UA_DataTypeMember MonitoredItemModifyRequest_members[2] = {
9469 #ifdef UA_ENABLE_TYPENAMES
9470  .memberName = "monitoredItemId",
9471 #endif
9472  .namespaceZero = true,
9473  .padding = 0,
9474  .isArray = false
9475  },
9476  { .memberTypeIndex = UA_TYPES_MONITORINGPARAMETERS,
9477 #ifdef UA_ENABLE_TYPENAMES
9478  .memberName = "requestedParameters",
9479 #endif
9480  .namespaceZero = true,
9481  .padding = offsetof(UA_MonitoredItemModifyRequest, requestedParameters) - offsetof(UA_MonitoredItemModifyRequest, monitoredItemId) - sizeof(UA_UInt32),
9482  .isArray = false
9483  },};
9484 
9485 /* UserNameIdentityToken */
9486 static UA_DataTypeMember UserNameIdentityToken_members[4] = {
9488 #ifdef UA_ENABLE_TYPENAMES
9489  .memberName = "policyId",
9490 #endif
9491  .namespaceZero = true,
9492  .padding = 0,
9493  .isArray = false
9494  },
9495  { .memberTypeIndex = UA_TYPES_STRING,
9496 #ifdef UA_ENABLE_TYPENAMES
9497  .memberName = "userName",
9498 #endif
9499  .namespaceZero = true,
9500  .padding = offsetof(UA_UserNameIdentityToken, userName) - offsetof(UA_UserNameIdentityToken, policyId) - sizeof(UA_String),
9501  .isArray = false
9502  },
9503  { .memberTypeIndex = UA_TYPES_BYTESTRING,
9504 #ifdef UA_ENABLE_TYPENAMES
9505  .memberName = "password",
9506 #endif
9507  .namespaceZero = true,
9508  .padding = offsetof(UA_UserNameIdentityToken, password) - offsetof(UA_UserNameIdentityToken, userName) - sizeof(UA_String),
9509  .isArray = false
9510  },
9511  { .memberTypeIndex = UA_TYPES_STRING,
9512 #ifdef UA_ENABLE_TYPENAMES
9513  .memberName = "encryptionAlgorithm",
9514 #endif
9515  .namespaceZero = true,
9516  .padding = offsetof(UA_UserNameIdentityToken, encryptionAlgorithm) - offsetof(UA_UserNameIdentityToken, password) - sizeof(UA_ByteString),
9517  .isArray = false
9518  },};
9519 
9520 /* IdType */
9521 static UA_DataTypeMember IdType_members[1] = {
9523 #ifdef UA_ENABLE_TYPENAMES
9524  .memberName = "",
9525 #endif
9526  .namespaceZero = true,
9527  .padding = 0,
9528  .isArray = false
9529  },};
9530 
9531 /* UserTokenType */
9532 static UA_DataTypeMember UserTokenType_members[1] = {
9534 #ifdef UA_ENABLE_TYPENAMES
9535  .memberName = "",
9536 #endif
9537  .namespaceZero = true,
9538  .padding = 0,
9539  .isArray = false
9540  },};
9541 
9542 /* ActivateSessionRequest */
9543 static UA_DataTypeMember ActivateSessionRequest_members[6] = {
9545 #ifdef UA_ENABLE_TYPENAMES
9546  .memberName = "requestHeader",
9547 #endif
9548  .namespaceZero = true,
9549  .padding = 0,
9550  .isArray = false
9551  },
9552  { .memberTypeIndex = UA_TYPES_SIGNATUREDATA,
9553 #ifdef UA_ENABLE_TYPENAMES
9554  .memberName = "clientSignature",
9555 #endif
9556  .namespaceZero = true,
9557  .padding = offsetof(UA_ActivateSessionRequest, clientSignature) - offsetof(UA_ActivateSessionRequest, requestHeader) - sizeof(UA_RequestHeader),
9558  .isArray = false
9559  },
9560  { .memberTypeIndex = UA_TYPES_SIGNEDSOFTWARECERTIFICATE,
9561 #ifdef UA_ENABLE_TYPENAMES
9562  .memberName = "clientSoftwareCertificates",
9563 #endif
9564  .namespaceZero = true,
9565  .padding = offsetof(UA_ActivateSessionRequest, clientSoftwareCertificatesSize) - offsetof(UA_ActivateSessionRequest, clientSignature) - sizeof(UA_SignatureData),
9566  .isArray = true
9567  },
9568  { .memberTypeIndex = UA_TYPES_STRING,
9569 #ifdef UA_ENABLE_TYPENAMES
9570  .memberName = "localeIds",
9571 #endif
9572  .namespaceZero = true,
9573  .padding = offsetof(UA_ActivateSessionRequest, localeIdsSize) - offsetof(UA_ActivateSessionRequest, clientSoftwareCertificates) - sizeof(void*),
9574  .isArray = true
9575  },
9576  { .memberTypeIndex = UA_TYPES_EXTENSIONOBJECT,
9577 #ifdef UA_ENABLE_TYPENAMES
9578  .memberName = "userIdentityToken",
9579 #endif
9580  .namespaceZero = true,
9581  .padding = offsetof(UA_ActivateSessionRequest, userIdentityToken) - offsetof(UA_ActivateSessionRequest, localeIds) - sizeof(void*),
9582  .isArray = false
9583  },
9584  { .memberTypeIndex = UA_TYPES_SIGNATUREDATA,
9585 #ifdef UA_ENABLE_TYPENAMES
9586  .memberName = "userTokenSignature",
9587 #endif
9588  .namespaceZero = true,
9589  .padding = offsetof(UA_ActivateSessionRequest, userTokenSignature) - offsetof(UA_ActivateSessionRequest, userIdentityToken) - sizeof(UA_ExtensionObject),
9590  .isArray = false
9591  },};
9592 
9593 /* OpenSecureChannelResponse */
9594 static UA_DataTypeMember OpenSecureChannelResponse_members[4] = {
9596 #ifdef UA_ENABLE_TYPENAMES
9597  .memberName = "responseHeader",
9598 #endif
9599  .namespaceZero = true,
9600  .padding = 0,
9601  .isArray = false
9602  },
9603  { .memberTypeIndex = UA_TYPES_UINT32,
9604 #ifdef UA_ENABLE_TYPENAMES
9605  .memberName = "serverProtocolVersion",
9606 #endif
9607  .namespaceZero = true,
9608  .padding = offsetof(UA_OpenSecureChannelResponse, serverProtocolVersion) - offsetof(UA_OpenSecureChannelResponse, responseHeader) - sizeof(UA_ResponseHeader),
9609  .isArray = false
9610  },
9611  { .memberTypeIndex = UA_TYPES_CHANNELSECURITYTOKEN,
9612 #ifdef UA_ENABLE_TYPENAMES
9613  .memberName = "securityToken",
9614 #endif
9615  .namespaceZero = true,
9616  .padding = offsetof(UA_OpenSecureChannelResponse, securityToken) - offsetof(UA_OpenSecureChannelResponse, serverProtocolVersion) - sizeof(UA_UInt32),
9617  .isArray = false
9618  },
9619  { .memberTypeIndex = UA_TYPES_BYTESTRING,
9620 #ifdef UA_ENABLE_TYPENAMES
9621  .memberName = "serverNonce",
9622 #endif
9623  .namespaceZero = true,
9624  .padding = offsetof(UA_OpenSecureChannelResponse, serverNonce) - offsetof(UA_OpenSecureChannelResponse, securityToken) - sizeof(UA_ChannelSecurityToken),
9625  .isArray = false
9626  },};
9627 
9628 /* ApplicationType */
9629 static UA_DataTypeMember ApplicationType_members[1] = {
9631 #ifdef UA_ENABLE_TYPENAMES
9632  .memberName = "",
9633 #endif
9634  .namespaceZero = true,
9635  .padding = 0,
9636  .isArray = false
9637  },};
9638 
9639 /* ServerState */
9640 static UA_DataTypeMember ServerState_members[1] = {
9642 #ifdef UA_ENABLE_TYPENAMES
9643  .memberName = "",
9644 #endif
9645  .namespaceZero = true,
9646  .padding = 0,
9647  .isArray = false
9648  },};
9649 
9650 /* QueryNextResponse */
9651 static UA_DataTypeMember QueryNextResponse_members[3] = {
9653 #ifdef UA_ENABLE_TYPENAMES
9654  .memberName = "responseHeader",
9655 #endif
9656  .namespaceZero = true,
9657  .padding = 0,
9658  .isArray = false
9659  },
9660  { .memberTypeIndex = UA_TYPES_QUERYDATASET,
9661 #ifdef UA_ENABLE_TYPENAMES
9662  .memberName = "queryDataSets",
9663 #endif
9664  .namespaceZero = true,
9665  .padding = offsetof(UA_QueryNextResponse, queryDataSetsSize) - offsetof(UA_QueryNextResponse, responseHeader) - sizeof(UA_ResponseHeader),
9666  .isArray = true
9667  },
9668  { .memberTypeIndex = UA_TYPES_BYTESTRING,
9669 #ifdef UA_ENABLE_TYPENAMES
9670  .memberName = "revisedContinuationPoint",
9671 #endif
9672  .namespaceZero = true,
9673  .padding = offsetof(UA_QueryNextResponse, revisedContinuationPoint) - offsetof(UA_QueryNextResponse, queryDataSets) - sizeof(void*),
9674  .isArray = false
9675  },};
9676 
9677 /* ActivateSessionResponse */
9678 static UA_DataTypeMember ActivateSessionResponse_members[4] = {
9680 #ifdef UA_ENABLE_TYPENAMES
9681  .memberName = "responseHeader",
9682 #endif
9683  .namespaceZero = true,
9684  .padding = 0,
9685  .isArray = false
9686  },
9687  { .memberTypeIndex = UA_TYPES_BYTESTRING,
9688 #ifdef UA_ENABLE_TYPENAMES
9689  .memberName = "serverNonce",
9690 #endif
9691  .namespaceZero = true,
9692  .padding = offsetof(UA_ActivateSessionResponse, serverNonce) - offsetof(UA_ActivateSessionResponse, responseHeader) - sizeof(UA_ResponseHeader),
9693  .isArray = false
9694  },
9695  { .memberTypeIndex = UA_TYPES_STATUSCODE,
9696 #ifdef UA_ENABLE_TYPENAMES
9697  .memberName = "results",
9698 #endif
9699  .namespaceZero = true,
9700  .padding = offsetof(UA_ActivateSessionResponse, resultsSize) - offsetof(UA_ActivateSessionResponse, serverNonce) - sizeof(UA_ByteString),
9701  .isArray = true
9702  },
9703  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
9704 #ifdef UA_ENABLE_TYPENAMES
9705  .memberName = "diagnosticInfos",
9706 #endif
9707  .namespaceZero = true,
9708  .padding = offsetof(UA_ActivateSessionResponse, diagnosticInfosSize) - offsetof(UA_ActivateSessionResponse, results) - sizeof(void*),
9709  .isArray = true
9710  },};
9711 
9712 /* FilterOperator */
9713 static UA_DataTypeMember FilterOperator_members[1] = {
9715 #ifdef UA_ENABLE_TYPENAMES
9716  .memberName = "",
9717 #endif
9718  .namespaceZero = true,
9719  .padding = 0,
9720  .isArray = false
9721  },};
9722 
9723 /* QueryNextRequest */
9724 static UA_DataTypeMember QueryNextRequest_members[3] = {
9726 #ifdef UA_ENABLE_TYPENAMES
9727  .memberName = "requestHeader",
9728 #endif
9729  .namespaceZero = true,
9730  .padding = 0,
9731  .isArray = false
9732  },
9733  { .memberTypeIndex = UA_TYPES_BOOLEAN,
9734 #ifdef UA_ENABLE_TYPENAMES
9735  .memberName = "releaseContinuationPoint",
9736 #endif
9737  .namespaceZero = true,
9738  .padding = offsetof(UA_QueryNextRequest, releaseContinuationPoint) - offsetof(UA_QueryNextRequest, requestHeader) - sizeof(UA_RequestHeader),
9739  .isArray = false
9740  },
9741  { .memberTypeIndex = UA_TYPES_BYTESTRING,
9742 #ifdef UA_ENABLE_TYPENAMES
9743  .memberName = "continuationPoint",
9744 #endif
9745  .namespaceZero = true,
9746  .padding = offsetof(UA_QueryNextRequest, continuationPoint) - offsetof(UA_QueryNextRequest, releaseContinuationPoint) - sizeof(UA_Boolean),
9747  .isArray = false
9748  },};
9749 
9750 /* WriteResponse */
9751 static UA_DataTypeMember WriteResponse_members[3] = {
9753 #ifdef UA_ENABLE_TYPENAMES
9754  .memberName = "responseHeader",
9755 #endif
9756  .namespaceZero = true,
9757  .padding = 0,
9758  .isArray = false
9759  },
9760  { .memberTypeIndex = UA_TYPES_STATUSCODE,
9761 #ifdef UA_ENABLE_TYPENAMES
9762  .memberName = "results",
9763 #endif
9764  .namespaceZero = true,
9765  .padding = offsetof(UA_WriteResponse, resultsSize) - offsetof(UA_WriteResponse, responseHeader) - sizeof(UA_ResponseHeader),
9766  .isArray = true
9767  },
9768  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
9769 #ifdef UA_ENABLE_TYPENAMES
9770  .memberName = "diagnosticInfos",
9771 #endif
9772  .namespaceZero = true,
9773  .padding = offsetof(UA_WriteResponse, diagnosticInfosSize) - offsetof(UA_WriteResponse, results) - sizeof(void*),
9774  .isArray = true
9775  },};
9776 
9777 /* BrowseNextRequest */
9778 static UA_DataTypeMember BrowseNextRequest_members[3] = {
9780 #ifdef UA_ENABLE_TYPENAMES
9781  .memberName = "requestHeader",
9782 #endif
9783  .namespaceZero = true,
9784  .padding = 0,
9785  .isArray = false
9786  },
9787  { .memberTypeIndex = UA_TYPES_BOOLEAN,
9788 #ifdef UA_ENABLE_TYPENAMES
9789  .memberName = "releaseContinuationPoints",
9790 #endif
9791  .namespaceZero = true,
9792  .padding = offsetof(UA_BrowseNextRequest, releaseContinuationPoints) - offsetof(UA_BrowseNextRequest, requestHeader) - sizeof(UA_RequestHeader),
9793  .isArray = false
9794  },
9795  { .memberTypeIndex = UA_TYPES_BYTESTRING,
9796 #ifdef UA_ENABLE_TYPENAMES
9797  .memberName = "continuationPoints",
9798 #endif
9799  .namespaceZero = true,
9800  .padding = offsetof(UA_BrowseNextRequest, continuationPointsSize) - offsetof(UA_BrowseNextRequest, releaseContinuationPoints) - sizeof(UA_Boolean),
9801  .isArray = true
9802  },};
9803 
9804 /* CreateSubscriptionRequest */
9805 static UA_DataTypeMember CreateSubscriptionRequest_members[7] = {
9807 #ifdef UA_ENABLE_TYPENAMES
9808  .memberName = "requestHeader",
9809 #endif
9810  .namespaceZero = true,
9811  .padding = 0,
9812  .isArray = false
9813  },
9814  { .memberTypeIndex = UA_TYPES_DOUBLE,
9815 #ifdef UA_ENABLE_TYPENAMES
9816  .memberName = "requestedPublishingInterval",
9817 #endif
9818  .namespaceZero = true,
9819  .padding = offsetof(UA_CreateSubscriptionRequest, requestedPublishingInterval) - offsetof(UA_CreateSubscriptionRequest, requestHeader) - sizeof(UA_RequestHeader),
9820  .isArray = false
9821  },
9822  { .memberTypeIndex = UA_TYPES_UINT32,
9823 #ifdef UA_ENABLE_TYPENAMES
9824  .memberName = "requestedLifetimeCount",
9825 #endif
9826  .namespaceZero = true,
9827  .padding = offsetof(UA_CreateSubscriptionRequest, requestedLifetimeCount) - offsetof(UA_CreateSubscriptionRequest, requestedPublishingInterval) - sizeof(UA_Double),
9828  .isArray = false
9829  },
9830  { .memberTypeIndex = UA_TYPES_UINT32,
9831 #ifdef UA_ENABLE_TYPENAMES
9832  .memberName = "requestedMaxKeepAliveCount",
9833 #endif
9834  .namespaceZero = true,
9835  .padding = offsetof(UA_CreateSubscriptionRequest, requestedMaxKeepAliveCount) - offsetof(UA_CreateSubscriptionRequest, requestedLifetimeCount) - sizeof(UA_UInt32),
9836  .isArray = false
9837  },
9838  { .memberTypeIndex = UA_TYPES_UINT32,
9839 #ifdef UA_ENABLE_TYPENAMES
9840  .memberName = "maxNotificationsPerPublish",
9841 #endif
9842  .namespaceZero = true,
9843  .padding = offsetof(UA_CreateSubscriptionRequest, maxNotificationsPerPublish) - offsetof(UA_CreateSubscriptionRequest, requestedMaxKeepAliveCount) - sizeof(UA_UInt32),
9844  .isArray = false
9845  },
9846  { .memberTypeIndex = UA_TYPES_BOOLEAN,
9847 #ifdef UA_ENABLE_TYPENAMES
9848  .memberName = "publishingEnabled",
9849 #endif
9850  .namespaceZero = true,
9851  .padding = offsetof(UA_CreateSubscriptionRequest, publishingEnabled) - offsetof(UA_CreateSubscriptionRequest, maxNotificationsPerPublish) - sizeof(UA_UInt32),
9852  .isArray = false
9853  },
9854  { .memberTypeIndex = UA_TYPES_BYTE,
9855 #ifdef UA_ENABLE_TYPENAMES
9856  .memberName = "priority",
9857 #endif
9858  .namespaceZero = true,
9859  .padding = offsetof(UA_CreateSubscriptionRequest, priority) - offsetof(UA_CreateSubscriptionRequest, publishingEnabled) - sizeof(UA_Boolean),
9860  .isArray = false
9861  },};
9862 
9863 /* VariableTypeAttributes */
9864 static UA_DataTypeMember VariableTypeAttributes_members[10] = {
9866 #ifdef UA_ENABLE_TYPENAMES
9867  .memberName = "specifiedAttributes",
9868 #endif
9869  .namespaceZero = true,
9870  .padding = 0,
9871  .isArray = false
9872  },
9873  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
9874 #ifdef UA_ENABLE_TYPENAMES
9875  .memberName = "displayName",
9876 #endif
9877  .namespaceZero = true,
9878  .padding = offsetof(UA_VariableTypeAttributes, displayName) - offsetof(UA_VariableTypeAttributes, specifiedAttributes) - sizeof(UA_UInt32),
9879  .isArray = false
9880  },
9881  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
9882 #ifdef UA_ENABLE_TYPENAMES
9883  .memberName = "description",
9884 #endif
9885  .namespaceZero = true,
9886  .padding = offsetof(UA_VariableTypeAttributes, description) - offsetof(UA_VariableTypeAttributes, displayName) - sizeof(UA_LocalizedText),
9887  .isArray = false
9888  },
9889  { .memberTypeIndex = UA_TYPES_UINT32,
9890 #ifdef UA_ENABLE_TYPENAMES
9891  .memberName = "writeMask",
9892 #endif
9893  .namespaceZero = true,
9894  .padding = offsetof(UA_VariableTypeAttributes, writeMask) - offsetof(UA_VariableTypeAttributes, description) - sizeof(UA_LocalizedText),
9895  .isArray = false
9896  },
9897  { .memberTypeIndex = UA_TYPES_UINT32,
9898 #ifdef UA_ENABLE_TYPENAMES
9899  .memberName = "userWriteMask",
9900 #endif
9901  .namespaceZero = true,
9902  .padding = offsetof(UA_VariableTypeAttributes, userWriteMask) - offsetof(UA_VariableTypeAttributes, writeMask) - sizeof(UA_UInt32),
9903  .isArray = false
9904  },
9905  { .memberTypeIndex = UA_TYPES_VARIANT,
9906 #ifdef UA_ENABLE_TYPENAMES
9907  .memberName = "value",
9908 #endif
9909  .namespaceZero = true,
9910  .padding = offsetof(UA_VariableTypeAttributes, value) - offsetof(UA_VariableTypeAttributes, userWriteMask) - sizeof(UA_UInt32),
9911  .isArray = false
9912  },
9913  { .memberTypeIndex = UA_TYPES_NODEID,
9914 #ifdef UA_ENABLE_TYPENAMES
9915  .memberName = "dataType",
9916 #endif
9917  .namespaceZero = true,
9918  .padding = offsetof(UA_VariableTypeAttributes, dataType) - offsetof(UA_VariableTypeAttributes, value) - sizeof(UA_Variant),
9919  .isArray = false
9920  },
9921  { .memberTypeIndex = UA_TYPES_INT32,
9922 #ifdef UA_ENABLE_TYPENAMES
9923  .memberName = "valueRank",
9924 #endif
9925  .namespaceZero = true,
9926  .padding = offsetof(UA_VariableTypeAttributes, valueRank) - offsetof(UA_VariableTypeAttributes, dataType) - sizeof(UA_NodeId),
9927  .isArray = false
9928  },
9929  { .memberTypeIndex = UA_TYPES_UINT32,
9930 #ifdef UA_ENABLE_TYPENAMES
9931  .memberName = "arrayDimensions",
9932 #endif
9933  .namespaceZero = true,
9934  .padding = offsetof(UA_VariableTypeAttributes, arrayDimensionsSize) - offsetof(UA_VariableTypeAttributes, valueRank) - sizeof(UA_Int32),
9935  .isArray = true
9936  },
9937  { .memberTypeIndex = UA_TYPES_BOOLEAN,
9938 #ifdef UA_ENABLE_TYPENAMES
9939  .memberName = "isAbstract",
9940 #endif
9941  .namespaceZero = true,
9942  .padding = offsetof(UA_VariableTypeAttributes, isAbstract) - offsetof(UA_VariableTypeAttributes, arrayDimensions) - sizeof(void*),
9943  .isArray = false
9944  },};
9945 
9946 /* BrowsePathResult */
9947 static UA_DataTypeMember BrowsePathResult_members[2] = {
9949 #ifdef UA_ENABLE_TYPENAMES
9950  .memberName = "statusCode",
9951 #endif
9952  .namespaceZero = true,
9953  .padding = 0,
9954  .isArray = false
9955  },
9956  { .memberTypeIndex = UA_TYPES_BROWSEPATHTARGET,
9957 #ifdef UA_ENABLE_TYPENAMES
9958  .memberName = "targets",
9959 #endif
9960  .namespaceZero = true,
9961  .padding = offsetof(UA_BrowsePathResult, targetsSize) - offsetof(UA_BrowsePathResult, statusCode) - sizeof(UA_StatusCode),
9962  .isArray = true
9963  },};
9964 
9965 /* ModifySubscriptionResponse */
9966 static UA_DataTypeMember ModifySubscriptionResponse_members[4] = {
9968 #ifdef UA_ENABLE_TYPENAMES
9969  .memberName = "responseHeader",
9970 #endif
9971  .namespaceZero = true,
9972  .padding = 0,
9973  .isArray = false
9974  },
9975  { .memberTypeIndex = UA_TYPES_DOUBLE,
9976 #ifdef UA_ENABLE_TYPENAMES
9977  .memberName = "revisedPublishingInterval",
9978 #endif
9979  .namespaceZero = true,
9980  .padding = offsetof(UA_ModifySubscriptionResponse, revisedPublishingInterval) - offsetof(UA_ModifySubscriptionResponse, responseHeader) - sizeof(UA_ResponseHeader),
9981  .isArray = false
9982  },
9983  { .memberTypeIndex = UA_TYPES_UINT32,
9984 #ifdef UA_ENABLE_TYPENAMES
9985  .memberName = "revisedLifetimeCount",
9986 #endif
9987  .namespaceZero = true,
9988  .padding = offsetof(UA_ModifySubscriptionResponse, revisedLifetimeCount) - offsetof(UA_ModifySubscriptionResponse, revisedPublishingInterval) - sizeof(UA_Double),
9989  .isArray = false
9990  },
9991  { .memberTypeIndex = UA_TYPES_UINT32,
9992 #ifdef UA_ENABLE_TYPENAMES
9993  .memberName = "revisedMaxKeepAliveCount",
9994 #endif
9995  .namespaceZero = true,
9996  .padding = offsetof(UA_ModifySubscriptionResponse, revisedMaxKeepAliveCount) - offsetof(UA_ModifySubscriptionResponse, revisedLifetimeCount) - sizeof(UA_UInt32),
9997  .isArray = false
9998  },};
9999 
10000 /* OpenSecureChannelRequest */
10001 static UA_DataTypeMember OpenSecureChannelRequest_members[6] = {
10003 #ifdef UA_ENABLE_TYPENAMES
10004  .memberName = "requestHeader",
10005 #endif
10006  .namespaceZero = true,
10007  .padding = 0,
10008  .isArray = false
10009  },
10010  { .memberTypeIndex = UA_TYPES_UINT32,
10011 #ifdef UA_ENABLE_TYPENAMES
10012  .memberName = "clientProtocolVersion",
10013 #endif
10014  .namespaceZero = true,
10015  .padding = offsetof(UA_OpenSecureChannelRequest, clientProtocolVersion) - offsetof(UA_OpenSecureChannelRequest, requestHeader) - sizeof(UA_RequestHeader),
10016  .isArray = false
10017  },
10018  { .memberTypeIndex = UA_TYPES_SECURITYTOKENREQUESTTYPE,
10019 #ifdef UA_ENABLE_TYPENAMES
10020  .memberName = "requestType",
10021 #endif
10022  .namespaceZero = true,
10023  .padding = offsetof(UA_OpenSecureChannelRequest, requestType) - offsetof(UA_OpenSecureChannelRequest, clientProtocolVersion) - sizeof(UA_UInt32),
10024  .isArray = false
10025  },
10026  { .memberTypeIndex = UA_TYPES_MESSAGESECURITYMODE,
10027 #ifdef UA_ENABLE_TYPENAMES
10028  .memberName = "securityMode",
10029 #endif
10030  .namespaceZero = true,
10031  .padding = offsetof(UA_OpenSecureChannelRequest, securityMode) - offsetof(UA_OpenSecureChannelRequest, requestType) - sizeof(UA_SecurityTokenRequestType),
10032  .isArray = false
10033  },
10034  { .memberTypeIndex = UA_TYPES_BYTESTRING,
10035 #ifdef UA_ENABLE_TYPENAMES
10036  .memberName = "clientNonce",
10037 #endif
10038  .namespaceZero = true,
10039  .padding = offsetof(UA_OpenSecureChannelRequest, clientNonce) - offsetof(UA_OpenSecureChannelRequest, securityMode) - sizeof(UA_MessageSecurityMode),
10040  .isArray = false
10041  },
10042  { .memberTypeIndex = UA_TYPES_UINT32,
10043 #ifdef UA_ENABLE_TYPENAMES
10044  .memberName = "requestedLifetime",
10045 #endif
10046  .namespaceZero = true,
10047  .padding = offsetof(UA_OpenSecureChannelRequest, requestedLifetime) - offsetof(UA_OpenSecureChannelRequest, clientNonce) - sizeof(UA_ByteString),
10048  .isArray = false
10049  },};
10050 
10051 /* RegisterNodesResponse */
10052 static UA_DataTypeMember RegisterNodesResponse_members[2] = {
10054 #ifdef UA_ENABLE_TYPENAMES
10055  .memberName = "responseHeader",
10056 #endif
10057  .namespaceZero = true,
10058  .padding = 0,
10059  .isArray = false
10060  },
10061  { .memberTypeIndex = UA_TYPES_NODEID,
10062 #ifdef UA_ENABLE_TYPENAMES
10063  .memberName = "registeredNodeIds",
10064 #endif
10065  .namespaceZero = true,
10066  .padding = offsetof(UA_RegisterNodesResponse, registeredNodeIdsSize) - offsetof(UA_RegisterNodesResponse, responseHeader) - sizeof(UA_ResponseHeader),
10067  .isArray = true
10068  },};
10069 
10070 /* CloseSessionRequest */
10071 static UA_DataTypeMember CloseSessionRequest_members[2] = {
10073 #ifdef UA_ENABLE_TYPENAMES
10074  .memberName = "requestHeader",
10075 #endif
10076  .namespaceZero = true,
10077  .padding = 0,
10078  .isArray = false
10079  },
10080  { .memberTypeIndex = UA_TYPES_BOOLEAN,
10081 #ifdef UA_ENABLE_TYPENAMES
10082  .memberName = "deleteSubscriptions",
10083 #endif
10084  .namespaceZero = true,
10085  .padding = offsetof(UA_CloseSessionRequest, deleteSubscriptions) - offsetof(UA_CloseSessionRequest, requestHeader) - sizeof(UA_RequestHeader),
10086  .isArray = false
10087  },};
10088 
10089 /* ModifySubscriptionRequest */
10090 static UA_DataTypeMember ModifySubscriptionRequest_members[7] = {
10092 #ifdef UA_ENABLE_TYPENAMES
10093  .memberName = "requestHeader",
10094 #endif
10095  .namespaceZero = true,
10096  .padding = 0,
10097  .isArray = false
10098  },
10099  { .memberTypeIndex = UA_TYPES_UINT32,
10100 #ifdef UA_ENABLE_TYPENAMES
10101  .memberName = "subscriptionId",
10102 #endif
10103  .namespaceZero = true,
10104  .padding = offsetof(UA_ModifySubscriptionRequest, subscriptionId) - offsetof(UA_ModifySubscriptionRequest, requestHeader) - sizeof(UA_RequestHeader),
10105  .isArray = false
10106  },
10107  { .memberTypeIndex = UA_TYPES_DOUBLE,
10108 #ifdef UA_ENABLE_TYPENAMES
10109  .memberName = "requestedPublishingInterval",
10110 #endif
10111  .namespaceZero = true,
10112  .padding = offsetof(UA_ModifySubscriptionRequest, requestedPublishingInterval) - offsetof(UA_ModifySubscriptionRequest, subscriptionId) - sizeof(UA_UInt32),
10113  .isArray = false
10114  },
10115  { .memberTypeIndex = UA_TYPES_UINT32,
10116 #ifdef UA_ENABLE_TYPENAMES
10117  .memberName = "requestedLifetimeCount",
10118 #endif
10119  .namespaceZero = true,
10120  .padding = offsetof(UA_ModifySubscriptionRequest, requestedLifetimeCount) - offsetof(UA_ModifySubscriptionRequest, requestedPublishingInterval) - sizeof(UA_Double),
10121  .isArray = false
10122  },
10123  { .memberTypeIndex = UA_TYPES_UINT32,
10124 #ifdef UA_ENABLE_TYPENAMES
10125  .memberName = "requestedMaxKeepAliveCount",
10126 #endif
10127  .namespaceZero = true,
10128  .padding = offsetof(UA_ModifySubscriptionRequest, requestedMaxKeepAliveCount) - offsetof(UA_ModifySubscriptionRequest, requestedLifetimeCount) - sizeof(UA_UInt32),
10129  .isArray = false
10130  },
10131  { .memberTypeIndex = UA_TYPES_UINT32,
10132 #ifdef UA_ENABLE_TYPENAMES
10133  .memberName = "maxNotificationsPerPublish",
10134 #endif
10135  .namespaceZero = true,
10136  .padding = offsetof(UA_ModifySubscriptionRequest, maxNotificationsPerPublish) - offsetof(UA_ModifySubscriptionRequest, requestedMaxKeepAliveCount) - sizeof(UA_UInt32),
10137  .isArray = false
10138  },
10139  { .memberTypeIndex = UA_TYPES_BYTE,
10140 #ifdef UA_ENABLE_TYPENAMES
10141  .memberName = "priority",
10142 #endif
10143  .namespaceZero = true,
10144  .padding = offsetof(UA_ModifySubscriptionRequest, priority) - offsetof(UA_ModifySubscriptionRequest, maxNotificationsPerPublish) - sizeof(UA_UInt32),
10145  .isArray = false
10146  },};
10147 
10148 /* UserTokenPolicy */
10149 static UA_DataTypeMember UserTokenPolicy_members[5] = {
10151 #ifdef UA_ENABLE_TYPENAMES
10152  .memberName = "policyId",
10153 #endif
10154  .namespaceZero = true,
10155  .padding = 0,
10156  .isArray = false
10157  },
10158  { .memberTypeIndex = UA_TYPES_USERTOKENTYPE,
10159 #ifdef UA_ENABLE_TYPENAMES
10160  .memberName = "tokenType",
10161 #endif
10162  .namespaceZero = true,
10163  .padding = offsetof(UA_UserTokenPolicy, tokenType) - offsetof(UA_UserTokenPolicy, policyId) - sizeof(UA_String),
10164  .isArray = false
10165  },
10166  { .memberTypeIndex = UA_TYPES_STRING,
10167 #ifdef UA_ENABLE_TYPENAMES
10168  .memberName = "issuedTokenType",
10169 #endif
10170  .namespaceZero = true,
10171  .padding = offsetof(UA_UserTokenPolicy, issuedTokenType) - offsetof(UA_UserTokenPolicy, tokenType) - sizeof(UA_UserTokenType),
10172  .isArray = false
10173  },
10174  { .memberTypeIndex = UA_TYPES_STRING,
10175 #ifdef UA_ENABLE_TYPENAMES
10176  .memberName = "issuerEndpointUrl",
10177 #endif
10178  .namespaceZero = true,
10179  .padding = offsetof(UA_UserTokenPolicy, issuerEndpointUrl) - offsetof(UA_UserTokenPolicy, issuedTokenType) - sizeof(UA_String),
10180  .isArray = false
10181  },
10182  { .memberTypeIndex = UA_TYPES_STRING,
10183 #ifdef UA_ENABLE_TYPENAMES
10184  .memberName = "securityPolicyUri",
10185 #endif
10186  .namespaceZero = true,
10187  .padding = offsetof(UA_UserTokenPolicy, securityPolicyUri) - offsetof(UA_UserTokenPolicy, issuerEndpointUrl) - sizeof(UA_String),
10188  .isArray = false
10189  },};
10190 
10191 /* DeleteMonitoredItemsRequest */
10192 static UA_DataTypeMember DeleteMonitoredItemsRequest_members[3] = {
10194 #ifdef UA_ENABLE_TYPENAMES
10195  .memberName = "requestHeader",
10196 #endif
10197  .namespaceZero = true,
10198  .padding = 0,
10199  .isArray = false
10200  },
10201  { .memberTypeIndex = UA_TYPES_UINT32,
10202 #ifdef UA_ENABLE_TYPENAMES
10203  .memberName = "subscriptionId",
10204 #endif
10205  .namespaceZero = true,
10206  .padding = offsetof(UA_DeleteMonitoredItemsRequest, subscriptionId) - offsetof(UA_DeleteMonitoredItemsRequest, requestHeader) - sizeof(UA_RequestHeader),
10207  .isArray = false
10208  },
10209  { .memberTypeIndex = UA_TYPES_UINT32,
10210 #ifdef UA_ENABLE_TYPENAMES
10211  .memberName = "monitoredItemIds",
10212 #endif
10213  .namespaceZero = true,
10214  .padding = offsetof(UA_DeleteMonitoredItemsRequest, monitoredItemIdsSize) - offsetof(UA_DeleteMonitoredItemsRequest, subscriptionId) - sizeof(UA_UInt32),
10215  .isArray = true
10216  },};
10217 
10218 /* ReferenceTypeAttributes */
10219 static UA_DataTypeMember ReferenceTypeAttributes_members[8] = {
10221 #ifdef UA_ENABLE_TYPENAMES
10222  .memberName = "specifiedAttributes",
10223 #endif
10224  .namespaceZero = true,
10225  .padding = 0,
10226  .isArray = false
10227  },
10228  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
10229 #ifdef UA_ENABLE_TYPENAMES
10230  .memberName = "displayName",
10231 #endif
10232  .namespaceZero = true,
10233  .padding = offsetof(UA_ReferenceTypeAttributes, displayName) - offsetof(UA_ReferenceTypeAttributes, specifiedAttributes) - sizeof(UA_UInt32),
10234  .isArray = false
10235  },
10236  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
10237 #ifdef UA_ENABLE_TYPENAMES
10238  .memberName = "description",
10239 #endif
10240  .namespaceZero = true,
10241  .padding = offsetof(UA_ReferenceTypeAttributes, description) - offsetof(UA_ReferenceTypeAttributes, displayName) - sizeof(UA_LocalizedText),
10242  .isArray = false
10243  },
10244  { .memberTypeIndex = UA_TYPES_UINT32,
10245 #ifdef UA_ENABLE_TYPENAMES
10246  .memberName = "writeMask",
10247 #endif
10248  .namespaceZero = true,
10249  .padding = offsetof(UA_ReferenceTypeAttributes, writeMask) - offsetof(UA_ReferenceTypeAttributes, description) - sizeof(UA_LocalizedText),
10250  .isArray = false
10251  },
10252  { .memberTypeIndex = UA_TYPES_UINT32,
10253 #ifdef UA_ENABLE_TYPENAMES
10254  .memberName = "userWriteMask",
10255 #endif
10256  .namespaceZero = true,
10257  .padding = offsetof(UA_ReferenceTypeAttributes, userWriteMask) - offsetof(UA_ReferenceTypeAttributes, writeMask) - sizeof(UA_UInt32),
10258  .isArray = false
10259  },
10260  { .memberTypeIndex = UA_TYPES_BOOLEAN,
10261 #ifdef UA_ENABLE_TYPENAMES
10262  .memberName = "isAbstract",
10263 #endif
10264  .namespaceZero = true,
10265  .padding = offsetof(UA_ReferenceTypeAttributes, isAbstract) - offsetof(UA_ReferenceTypeAttributes, userWriteMask) - sizeof(UA_UInt32),
10266  .isArray = false
10267  },
10268  { .memberTypeIndex = UA_TYPES_BOOLEAN,
10269 #ifdef UA_ENABLE_TYPENAMES
10270  .memberName = "symmetric",
10271 #endif
10272  .namespaceZero = true,
10273  .padding = offsetof(UA_ReferenceTypeAttributes, symmetric) - offsetof(UA_ReferenceTypeAttributes, isAbstract) - sizeof(UA_Boolean),
10274  .isArray = false
10275  },
10276  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
10277 #ifdef UA_ENABLE_TYPENAMES
10278  .memberName = "inverseName",
10279 #endif
10280  .namespaceZero = true,
10281  .padding = offsetof(UA_ReferenceTypeAttributes, inverseName) - offsetof(UA_ReferenceTypeAttributes, symmetric) - sizeof(UA_Boolean),
10282  .isArray = false
10283  },};
10284 
10285 /* SetMonitoringModeRequest */
10286 static UA_DataTypeMember SetMonitoringModeRequest_members[4] = {
10288 #ifdef UA_ENABLE_TYPENAMES
10289  .memberName = "requestHeader",
10290 #endif
10291  .namespaceZero = true,
10292  .padding = 0,
10293  .isArray = false
10294  },
10295  { .memberTypeIndex = UA_TYPES_UINT32,
10296 #ifdef UA_ENABLE_TYPENAMES
10297  .memberName = "subscriptionId",
10298 #endif
10299  .namespaceZero = true,
10300  .padding = offsetof(UA_SetMonitoringModeRequest, subscriptionId) - offsetof(UA_SetMonitoringModeRequest, requestHeader) - sizeof(UA_RequestHeader),
10301  .isArray = false
10302  },
10303  { .memberTypeIndex = UA_TYPES_MONITORINGMODE,
10304 #ifdef UA_ENABLE_TYPENAMES
10305  .memberName = "monitoringMode",
10306 #endif
10307  .namespaceZero = true,
10308  .padding = offsetof(UA_SetMonitoringModeRequest, monitoringMode) - offsetof(UA_SetMonitoringModeRequest, subscriptionId) - sizeof(UA_UInt32),
10309  .isArray = false
10310  },
10311  { .memberTypeIndex = UA_TYPES_UINT32,
10312 #ifdef UA_ENABLE_TYPENAMES
10313  .memberName = "monitoredItemIds",
10314 #endif
10315  .namespaceZero = true,
10316  .padding = offsetof(UA_SetMonitoringModeRequest, monitoredItemIdsSize) - offsetof(UA_SetMonitoringModeRequest, monitoringMode) - sizeof(UA_MonitoringMode),
10317  .isArray = true
10318  },};
10319 
10320 /* UnregisterNodesResponse */
10321 static UA_DataTypeMember UnregisterNodesResponse_members[1] = {
10323 #ifdef UA_ENABLE_TYPENAMES
10324  .memberName = "responseHeader",
10325 #endif
10326  .namespaceZero = true,
10327  .padding = 0,
10328  .isArray = false
10329  },};
10330 
10331 /* WriteRequest */
10332 static UA_DataTypeMember WriteRequest_members[2] = {
10334 #ifdef UA_ENABLE_TYPENAMES
10335  .memberName = "requestHeader",
10336 #endif
10337  .namespaceZero = true,
10338  .padding = 0,
10339  .isArray = false
10340  },
10341  { .memberTypeIndex = UA_TYPES_WRITEVALUE,
10342 #ifdef UA_ENABLE_TYPENAMES
10343  .memberName = "nodesToWrite",
10344 #endif
10345  .namespaceZero = true,
10346  .padding = offsetof(UA_WriteRequest, nodesToWriteSize) - offsetof(UA_WriteRequest, requestHeader) - sizeof(UA_RequestHeader),
10347  .isArray = true
10348  },};
10349 
10350 /* ObjectAttributes */
10351 static UA_DataTypeMember ObjectAttributes_members[6] = {
10353 #ifdef UA_ENABLE_TYPENAMES
10354  .memberName = "specifiedAttributes",
10355 #endif
10356  .namespaceZero = true,
10357  .padding = 0,
10358  .isArray = false
10359  },
10360  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
10361 #ifdef UA_ENABLE_TYPENAMES
10362  .memberName = "displayName",
10363 #endif
10364  .namespaceZero = true,
10365  .padding = offsetof(UA_ObjectAttributes, displayName) - offsetof(UA_ObjectAttributes, specifiedAttributes) - sizeof(UA_UInt32),
10366  .isArray = false
10367  },
10368  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
10369 #ifdef UA_ENABLE_TYPENAMES
10370  .memberName = "description",
10371 #endif
10372  .namespaceZero = true,
10373  .padding = offsetof(UA_ObjectAttributes, description) - offsetof(UA_ObjectAttributes, displayName) - sizeof(UA_LocalizedText),
10374  .isArray = false
10375  },
10376  { .memberTypeIndex = UA_TYPES_UINT32,
10377 #ifdef UA_ENABLE_TYPENAMES
10378  .memberName = "writeMask",
10379 #endif
10380  .namespaceZero = true,
10381  .padding = offsetof(UA_ObjectAttributes, writeMask) - offsetof(UA_ObjectAttributes, description) - sizeof(UA_LocalizedText),
10382  .isArray = false
10383  },
10384  { .memberTypeIndex = UA_TYPES_UINT32,
10385 #ifdef UA_ENABLE_TYPENAMES
10386  .memberName = "userWriteMask",
10387 #endif
10388  .namespaceZero = true,
10389  .padding = offsetof(UA_ObjectAttributes, userWriteMask) - offsetof(UA_ObjectAttributes, writeMask) - sizeof(UA_UInt32),
10390  .isArray = false
10391  },
10392  { .memberTypeIndex = UA_TYPES_BYTE,
10393 #ifdef UA_ENABLE_TYPENAMES
10394  .memberName = "eventNotifier",
10395 #endif
10396  .namespaceZero = true,
10397  .padding = offsetof(UA_ObjectAttributes, eventNotifier) - offsetof(UA_ObjectAttributes, userWriteMask) - sizeof(UA_UInt32),
10398  .isArray = false
10399  },};
10400 
10401 /* BrowseDescription */
10402 static UA_DataTypeMember BrowseDescription_members[6] = {
10404 #ifdef UA_ENABLE_TYPENAMES
10405  .memberName = "nodeId",
10406 #endif
10407  .namespaceZero = true,
10408  .padding = 0,
10409  .isArray = false
10410  },
10411  { .memberTypeIndex = UA_TYPES_BROWSEDIRECTION,
10412 #ifdef UA_ENABLE_TYPENAMES
10413  .memberName = "browseDirection",
10414 #endif
10415  .namespaceZero = true,
10416  .padding = offsetof(UA_BrowseDescription, browseDirection) - offsetof(UA_BrowseDescription, nodeId) - sizeof(UA_NodeId),
10417  .isArray = false
10418  },
10419  { .memberTypeIndex = UA_TYPES_NODEID,
10420 #ifdef UA_ENABLE_TYPENAMES
10421  .memberName = "referenceTypeId",
10422 #endif
10423  .namespaceZero = true,
10424  .padding = offsetof(UA_BrowseDescription, referenceTypeId) - offsetof(UA_BrowseDescription, browseDirection) - sizeof(UA_BrowseDirection),
10425  .isArray = false
10426  },
10427  { .memberTypeIndex = UA_TYPES_BOOLEAN,
10428 #ifdef UA_ENABLE_TYPENAMES
10429  .memberName = "includeSubtypes",
10430 #endif
10431  .namespaceZero = true,
10432  .padding = offsetof(UA_BrowseDescription, includeSubtypes) - offsetof(UA_BrowseDescription, referenceTypeId) - sizeof(UA_NodeId),
10433  .isArray = false
10434  },
10435  { .memberTypeIndex = UA_TYPES_UINT32,
10436 #ifdef UA_ENABLE_TYPENAMES
10437  .memberName = "nodeClassMask",
10438 #endif
10439  .namespaceZero = true,
10440  .padding = offsetof(UA_BrowseDescription, nodeClassMask) - offsetof(UA_BrowseDescription, includeSubtypes) - sizeof(UA_Boolean),
10441  .isArray = false
10442  },
10443  { .memberTypeIndex = UA_TYPES_UINT32,
10444 #ifdef UA_ENABLE_TYPENAMES
10445  .memberName = "resultMask",
10446 #endif
10447  .namespaceZero = true,
10448  .padding = offsetof(UA_BrowseDescription, resultMask) - offsetof(UA_BrowseDescription, nodeClassMask) - sizeof(UA_UInt32),
10449  .isArray = false
10450  },};
10451 
10452 /* RepublishRequest */
10453 static UA_DataTypeMember RepublishRequest_members[3] = {
10455 #ifdef UA_ENABLE_TYPENAMES
10456  .memberName = "requestHeader",
10457 #endif
10458  .namespaceZero = true,
10459  .padding = 0,
10460  .isArray = false
10461  },
10462  { .memberTypeIndex = UA_TYPES_UINT32,
10463 #ifdef UA_ENABLE_TYPENAMES
10464  .memberName = "subscriptionId",
10465 #endif
10466  .namespaceZero = true,
10467  .padding = offsetof(UA_RepublishRequest, subscriptionId) - offsetof(UA_RepublishRequest, requestHeader) - sizeof(UA_RequestHeader),
10468  .isArray = false
10469  },
10470  { .memberTypeIndex = UA_TYPES_UINT32,
10471 #ifdef UA_ENABLE_TYPENAMES
10472  .memberName = "retransmitSequenceNumber",
10473 #endif
10474  .namespaceZero = true,
10475  .padding = offsetof(UA_RepublishRequest, retransmitSequenceNumber) - offsetof(UA_RepublishRequest, subscriptionId) - sizeof(UA_UInt32),
10476  .isArray = false
10477  },};
10478 
10479 /* GetEndpointsRequest */
10480 static UA_DataTypeMember GetEndpointsRequest_members[4] = {
10482 #ifdef UA_ENABLE_TYPENAMES
10483  .memberName = "requestHeader",
10484 #endif
10485  .namespaceZero = true,
10486  .padding = 0,
10487  .isArray = false
10488  },
10489  { .memberTypeIndex = UA_TYPES_STRING,
10490 #ifdef UA_ENABLE_TYPENAMES
10491  .memberName = "endpointUrl",
10492 #endif
10493  .namespaceZero = true,
10494  .padding = offsetof(UA_GetEndpointsRequest, endpointUrl) - offsetof(UA_GetEndpointsRequest, requestHeader) - sizeof(UA_RequestHeader),
10495  .isArray = false
10496  },
10497  { .memberTypeIndex = UA_TYPES_STRING,
10498 #ifdef UA_ENABLE_TYPENAMES
10499  .memberName = "localeIds",
10500 #endif
10501  .namespaceZero = true,
10502  .padding = offsetof(UA_GetEndpointsRequest, localeIdsSize) - offsetof(UA_GetEndpointsRequest, endpointUrl) - sizeof(UA_String),
10503  .isArray = true
10504  },
10505  { .memberTypeIndex = UA_TYPES_STRING,
10506 #ifdef UA_ENABLE_TYPENAMES
10507  .memberName = "profileUris",
10508 #endif
10509  .namespaceZero = true,
10510  .padding = offsetof(UA_GetEndpointsRequest, profileUrisSize) - offsetof(UA_GetEndpointsRequest, localeIds) - sizeof(void*),
10511  .isArray = true
10512  },};
10513 
10514 /* PublishRequest */
10515 static UA_DataTypeMember PublishRequest_members[2] = {
10517 #ifdef UA_ENABLE_TYPENAMES
10518  .memberName = "requestHeader",
10519 #endif
10520  .namespaceZero = true,
10521  .padding = 0,
10522  .isArray = false
10523  },
10524  { .memberTypeIndex = UA_TYPES_SUBSCRIPTIONACKNOWLEDGEMENT,
10525 #ifdef UA_ENABLE_TYPENAMES
10526  .memberName = "subscriptionAcknowledgements",
10527 #endif
10528  .namespaceZero = true,
10529  .padding = offsetof(UA_PublishRequest, subscriptionAcknowledgementsSize) - offsetof(UA_PublishRequest, requestHeader) - sizeof(UA_RequestHeader),
10530  .isArray = true
10531  },};
10532 
10533 /* AddNodesResponse */
10534 static UA_DataTypeMember AddNodesResponse_members[3] = {
10536 #ifdef UA_ENABLE_TYPENAMES
10537  .memberName = "responseHeader",
10538 #endif
10539  .namespaceZero = true,
10540  .padding = 0,
10541  .isArray = false
10542  },
10543  { .memberTypeIndex = UA_TYPES_ADDNODESRESULT,
10544 #ifdef UA_ENABLE_TYPENAMES
10545  .memberName = "results",
10546 #endif
10547  .namespaceZero = true,
10548  .padding = offsetof(UA_AddNodesResponse, resultsSize) - offsetof(UA_AddNodesResponse, responseHeader) - sizeof(UA_ResponseHeader),
10549  .isArray = true
10550  },
10551  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
10552 #ifdef UA_ENABLE_TYPENAMES
10553  .memberName = "diagnosticInfos",
10554 #endif
10555  .namespaceZero = true,
10556  .padding = offsetof(UA_AddNodesResponse, diagnosticInfosSize) - offsetof(UA_AddNodesResponse, results) - sizeof(void*),
10557  .isArray = true
10558  },};
10559 
10560 /* DataChangeNotification */
10561 static UA_DataTypeMember DataChangeNotification_members[2] = {
10563 #ifdef UA_ENABLE_TYPENAMES
10564  .memberName = "monitoredItems",
10565 #endif
10566  .namespaceZero = true,
10567  .padding = 0,
10568  .isArray = true
10569  },
10570  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
10571 #ifdef UA_ENABLE_TYPENAMES
10572  .memberName = "diagnosticInfos",
10573 #endif
10574  .namespaceZero = true,
10575  .padding = offsetof(UA_DataChangeNotification, diagnosticInfosSize) - offsetof(UA_DataChangeNotification, monitoredItems) - sizeof(void*),
10576  .isArray = true
10577  },};
10578 
10579 /* CloseSecureChannelResponse */
10580 static UA_DataTypeMember CloseSecureChannelResponse_members[1] = {
10582 #ifdef UA_ENABLE_TYPENAMES
10583  .memberName = "responseHeader",
10584 #endif
10585  .namespaceZero = true,
10586  .padding = 0,
10587  .isArray = false
10588  },};
10589 
10590 /* ModifyMonitoredItemsRequest */
10591 static UA_DataTypeMember ModifyMonitoredItemsRequest_members[4] = {
10593 #ifdef UA_ENABLE_TYPENAMES
10594  .memberName = "requestHeader",
10595 #endif
10596  .namespaceZero = true,
10597  .padding = 0,
10598  .isArray = false
10599  },
10600  { .memberTypeIndex = UA_TYPES_UINT32,
10601 #ifdef UA_ENABLE_TYPENAMES
10602  .memberName = "subscriptionId",
10603 #endif
10604  .namespaceZero = true,
10605  .padding = offsetof(UA_ModifyMonitoredItemsRequest, subscriptionId) - offsetof(UA_ModifyMonitoredItemsRequest, requestHeader) - sizeof(UA_RequestHeader),
10606  .isArray = false
10607  },
10608  { .memberTypeIndex = UA_TYPES_TIMESTAMPSTORETURN,
10609 #ifdef UA_ENABLE_TYPENAMES
10610  .memberName = "timestampsToReturn",
10611 #endif
10612  .namespaceZero = true,
10613  .padding = offsetof(UA_ModifyMonitoredItemsRequest, timestampsToReturn) - offsetof(UA_ModifyMonitoredItemsRequest, subscriptionId) - sizeof(UA_UInt32),
10614  .isArray = false
10615  },
10616  { .memberTypeIndex = UA_TYPES_MONITOREDITEMMODIFYREQUEST,
10617 #ifdef UA_ENABLE_TYPENAMES
10618  .memberName = "itemsToModify",
10619 #endif
10620  .namespaceZero = true,
10621  .padding = offsetof(UA_ModifyMonitoredItemsRequest, itemsToModifySize) - offsetof(UA_ModifyMonitoredItemsRequest, timestampsToReturn) - sizeof(UA_TimestampsToReturn),
10622  .isArray = true
10623  },};
10624 
10625 /* SetMonitoringModeResponse */
10626 static UA_DataTypeMember SetMonitoringModeResponse_members[3] = {
10628 #ifdef UA_ENABLE_TYPENAMES
10629  .memberName = "responseHeader",
10630 #endif
10631  .namespaceZero = true,
10632  .padding = 0,
10633  .isArray = false
10634  },
10635  { .memberTypeIndex = UA_TYPES_STATUSCODE,
10636 #ifdef UA_ENABLE_TYPENAMES
10637  .memberName = "results",
10638 #endif
10639  .namespaceZero = true,
10640  .padding = offsetof(UA_SetMonitoringModeResponse, resultsSize) - offsetof(UA_SetMonitoringModeResponse, responseHeader) - sizeof(UA_ResponseHeader),
10641  .isArray = true
10642  },
10643  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
10644 #ifdef UA_ENABLE_TYPENAMES
10645  .memberName = "diagnosticInfos",
10646 #endif
10647  .namespaceZero = true,
10648  .padding = offsetof(UA_SetMonitoringModeResponse, diagnosticInfosSize) - offsetof(UA_SetMonitoringModeResponse, results) - sizeof(void*),
10649  .isArray = true
10650  },};
10651 
10652 /* FindServersRequest */
10653 static UA_DataTypeMember FindServersRequest_members[4] = {
10655 #ifdef UA_ENABLE_TYPENAMES
10656  .memberName = "requestHeader",
10657 #endif
10658  .namespaceZero = true,
10659  .padding = 0,
10660  .isArray = false
10661  },
10662  { .memberTypeIndex = UA_TYPES_STRING,
10663 #ifdef UA_ENABLE_TYPENAMES
10664  .memberName = "endpointUrl",
10665 #endif
10666  .namespaceZero = true,
10667  .padding = offsetof(UA_FindServersRequest, endpointUrl) - offsetof(UA_FindServersRequest, requestHeader) - sizeof(UA_RequestHeader),
10668  .isArray = false
10669  },
10670  { .memberTypeIndex = UA_TYPES_STRING,
10671 #ifdef UA_ENABLE_TYPENAMES
10672  .memberName = "localeIds",
10673 #endif
10674  .namespaceZero = true,
10675  .padding = offsetof(UA_FindServersRequest, localeIdsSize) - offsetof(UA_FindServersRequest, endpointUrl) - sizeof(UA_String),
10676  .isArray = true
10677  },
10678  { .memberTypeIndex = UA_TYPES_STRING,
10679 #ifdef UA_ENABLE_TYPENAMES
10680  .memberName = "serverUris",
10681 #endif
10682  .namespaceZero = true,
10683  .padding = offsetof(UA_FindServersRequest, serverUrisSize) - offsetof(UA_FindServersRequest, localeIds) - sizeof(void*),
10684  .isArray = true
10685  },};
10686 
10687 /* ReferenceDescription */
10688 static UA_DataTypeMember ReferenceDescription_members[7] = {
10690 #ifdef UA_ENABLE_TYPENAMES
10691  .memberName = "referenceTypeId",
10692 #endif
10693  .namespaceZero = true,
10694  .padding = 0,
10695  .isArray = false
10696  },
10697  { .memberTypeIndex = UA_TYPES_BOOLEAN,
10698 #ifdef UA_ENABLE_TYPENAMES
10699  .memberName = "isForward",
10700 #endif
10701  .namespaceZero = true,
10702  .padding = offsetof(UA_ReferenceDescription, isForward) - offsetof(UA_ReferenceDescription, referenceTypeId) - sizeof(UA_NodeId),
10703  .isArray = false
10704  },
10705  { .memberTypeIndex = UA_TYPES_EXPANDEDNODEID,
10706 #ifdef UA_ENABLE_TYPENAMES
10707  .memberName = "nodeId",
10708 #endif
10709  .namespaceZero = true,
10710  .padding = offsetof(UA_ReferenceDescription, nodeId) - offsetof(UA_ReferenceDescription, isForward) - sizeof(UA_Boolean),
10711  .isArray = false
10712  },
10713  { .memberTypeIndex = UA_TYPES_QUALIFIEDNAME,
10714 #ifdef UA_ENABLE_TYPENAMES
10715  .memberName = "browseName",
10716 #endif
10717  .namespaceZero = true,
10718  .padding = offsetof(UA_ReferenceDescription, browseName) - offsetof(UA_ReferenceDescription, nodeId) - sizeof(UA_ExpandedNodeId),
10719  .isArray = false
10720  },
10721  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
10722 #ifdef UA_ENABLE_TYPENAMES
10723  .memberName = "displayName",
10724 #endif
10725  .namespaceZero = true,
10726  .padding = offsetof(UA_ReferenceDescription, displayName) - offsetof(UA_ReferenceDescription, browseName) - sizeof(UA_QualifiedName),
10727  .isArray = false
10728  },
10729  { .memberTypeIndex = UA_TYPES_NODECLASS,
10730 #ifdef UA_ENABLE_TYPENAMES
10731  .memberName = "nodeClass",
10732 #endif
10733  .namespaceZero = true,
10734  .padding = offsetof(UA_ReferenceDescription, nodeClass) - offsetof(UA_ReferenceDescription, displayName) - sizeof(UA_LocalizedText),
10735  .isArray = false
10736  },
10737  { .memberTypeIndex = UA_TYPES_EXPANDEDNODEID,
10738 #ifdef UA_ENABLE_TYPENAMES
10739  .memberName = "typeDefinition",
10740 #endif
10741  .namespaceZero = true,
10742  .padding = offsetof(UA_ReferenceDescription, typeDefinition) - offsetof(UA_ReferenceDescription, nodeClass) - sizeof(UA_NodeClass),
10743  .isArray = false
10744  },};
10745 
10746 /* SetPublishingModeResponse */
10747 static UA_DataTypeMember SetPublishingModeResponse_members[3] = {
10749 #ifdef UA_ENABLE_TYPENAMES
10750  .memberName = "responseHeader",
10751 #endif
10752  .namespaceZero = true,
10753  .padding = 0,
10754  .isArray = false
10755  },
10756  { .memberTypeIndex = UA_TYPES_STATUSCODE,
10757 #ifdef UA_ENABLE_TYPENAMES
10758  .memberName = "results",
10759 #endif
10760  .namespaceZero = true,
10761  .padding = offsetof(UA_SetPublishingModeResponse, resultsSize) - offsetof(UA_SetPublishingModeResponse, responseHeader) - sizeof(UA_ResponseHeader),
10762  .isArray = true
10763  },
10764  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
10765 #ifdef UA_ENABLE_TYPENAMES
10766  .memberName = "diagnosticInfos",
10767 #endif
10768  .namespaceZero = true,
10769  .padding = offsetof(UA_SetPublishingModeResponse, diagnosticInfosSize) - offsetof(UA_SetPublishingModeResponse, results) - sizeof(void*),
10770  .isArray = true
10771  },};
10772 
10773 /* ContentFilterResult */
10774 static UA_DataTypeMember ContentFilterResult_members[2] = {
10776 #ifdef UA_ENABLE_TYPENAMES
10777  .memberName = "elementResults",
10778 #endif
10779  .namespaceZero = true,
10780  .padding = 0,
10781  .isArray = true
10782  },
10783  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
10784 #ifdef UA_ENABLE_TYPENAMES
10785  .memberName = "elementDiagnosticInfos",
10786 #endif
10787  .namespaceZero = true,
10788  .padding = offsetof(UA_ContentFilterResult, elementDiagnosticInfosSize) - offsetof(UA_ContentFilterResult, elementResults) - sizeof(void*),
10789  .isArray = true
10790  },};
10791 
10792 /* AddReferencesItem */
10793 static UA_DataTypeMember AddReferencesItem_members[6] = {
10795 #ifdef UA_ENABLE_TYPENAMES
10796  .memberName = "sourceNodeId",
10797 #endif
10798  .namespaceZero = true,
10799  .padding = 0,
10800  .isArray = false
10801  },
10802  { .memberTypeIndex = UA_TYPES_NODEID,
10803 #ifdef UA_ENABLE_TYPENAMES
10804  .memberName = "referenceTypeId",
10805 #endif
10806  .namespaceZero = true,
10807  .padding = offsetof(UA_AddReferencesItem, referenceTypeId) - offsetof(UA_AddReferencesItem, sourceNodeId) - sizeof(UA_NodeId),
10808  .isArray = false
10809  },
10810  { .memberTypeIndex = UA_TYPES_BOOLEAN,
10811 #ifdef UA_ENABLE_TYPENAMES
10812  .memberName = "isForward",
10813 #endif
10814  .namespaceZero = true,
10815  .padding = offsetof(UA_AddReferencesItem, isForward) - offsetof(UA_AddReferencesItem, referenceTypeId) - sizeof(UA_NodeId),
10816  .isArray = false
10817  },
10818  { .memberTypeIndex = UA_TYPES_STRING,
10819 #ifdef UA_ENABLE_TYPENAMES
10820  .memberName = "targetServerUri",
10821 #endif
10822  .namespaceZero = true,
10823  .padding = offsetof(UA_AddReferencesItem, targetServerUri) - offsetof(UA_AddReferencesItem, isForward) - sizeof(UA_Boolean),
10824  .isArray = false
10825  },
10826  { .memberTypeIndex = UA_TYPES_EXPANDEDNODEID,
10827 #ifdef UA_ENABLE_TYPENAMES
10828  .memberName = "targetNodeId",
10829 #endif
10830  .namespaceZero = true,
10831  .padding = offsetof(UA_AddReferencesItem, targetNodeId) - offsetof(UA_AddReferencesItem, targetServerUri) - sizeof(UA_String),
10832  .isArray = false
10833  },
10834  { .memberTypeIndex = UA_TYPES_NODECLASS,
10835 #ifdef UA_ENABLE_TYPENAMES
10836  .memberName = "targetNodeClass",
10837 #endif
10838  .namespaceZero = true,
10839  .padding = offsetof(UA_AddReferencesItem, targetNodeClass) - offsetof(UA_AddReferencesItem, targetNodeId) - sizeof(UA_ExpandedNodeId),
10840  .isArray = false
10841  },};
10842 
10843 /* CreateSubscriptionResponse */
10844 static UA_DataTypeMember CreateSubscriptionResponse_members[5] = {
10846 #ifdef UA_ENABLE_TYPENAMES
10847  .memberName = "responseHeader",
10848 #endif
10849  .namespaceZero = true,
10850  .padding = 0,
10851  .isArray = false
10852  },
10853  { .memberTypeIndex = UA_TYPES_UINT32,
10854 #ifdef UA_ENABLE_TYPENAMES
10855  .memberName = "subscriptionId",
10856 #endif
10857  .namespaceZero = true,
10858  .padding = offsetof(UA_CreateSubscriptionResponse, subscriptionId) - offsetof(UA_CreateSubscriptionResponse, responseHeader) - sizeof(UA_ResponseHeader),
10859  .isArray = false
10860  },
10861  { .memberTypeIndex = UA_TYPES_DOUBLE,
10862 #ifdef UA_ENABLE_TYPENAMES
10863  .memberName = "revisedPublishingInterval",
10864 #endif
10865  .namespaceZero = true,
10866  .padding = offsetof(UA_CreateSubscriptionResponse, revisedPublishingInterval) - offsetof(UA_CreateSubscriptionResponse, subscriptionId) - sizeof(UA_UInt32),
10867  .isArray = false
10868  },
10869  { .memberTypeIndex = UA_TYPES_UINT32,
10870 #ifdef UA_ENABLE_TYPENAMES
10871  .memberName = "revisedLifetimeCount",
10872 #endif
10873  .namespaceZero = true,
10874  .padding = offsetof(UA_CreateSubscriptionResponse, revisedLifetimeCount) - offsetof(UA_CreateSubscriptionResponse, revisedPublishingInterval) - sizeof(UA_Double),
10875  .isArray = false
10876  },
10877  { .memberTypeIndex = UA_TYPES_UINT32,
10878 #ifdef UA_ENABLE_TYPENAMES
10879  .memberName = "revisedMaxKeepAliveCount",
10880 #endif
10881  .namespaceZero = true,
10882  .padding = offsetof(UA_CreateSubscriptionResponse, revisedMaxKeepAliveCount) - offsetof(UA_CreateSubscriptionResponse, revisedLifetimeCount) - sizeof(UA_UInt32),
10883  .isArray = false
10884  },};
10885 
10886 /* DeleteSubscriptionsResponse */
10887 static UA_DataTypeMember DeleteSubscriptionsResponse_members[3] = {
10889 #ifdef UA_ENABLE_TYPENAMES
10890  .memberName = "responseHeader",
10891 #endif
10892  .namespaceZero = true,
10893  .padding = 0,
10894  .isArray = false
10895  },
10896  { .memberTypeIndex = UA_TYPES_STATUSCODE,
10897 #ifdef UA_ENABLE_TYPENAMES
10898  .memberName = "results",
10899 #endif
10900  .namespaceZero = true,
10901  .padding = offsetof(UA_DeleteSubscriptionsResponse, resultsSize) - offsetof(UA_DeleteSubscriptionsResponse, responseHeader) - sizeof(UA_ResponseHeader),
10902  .isArray = true
10903  },
10904  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
10905 #ifdef UA_ENABLE_TYPENAMES
10906  .memberName = "diagnosticInfos",
10907 #endif
10908  .namespaceZero = true,
10909  .padding = offsetof(UA_DeleteSubscriptionsResponse, diagnosticInfosSize) - offsetof(UA_DeleteSubscriptionsResponse, results) - sizeof(void*),
10910  .isArray = true
10911  },};
10912 
10913 /* RelativePath */
10914 static UA_DataTypeMember RelativePath_members[1] = {
10916 #ifdef UA_ENABLE_TYPENAMES
10917  .memberName = "elements",
10918 #endif
10919  .namespaceZero = true,
10920  .padding = 0,
10921  .isArray = true
10922  },};
10923 
10924 /* DeleteReferencesResponse */
10925 static UA_DataTypeMember DeleteReferencesResponse_members[3] = {
10927 #ifdef UA_ENABLE_TYPENAMES
10928  .memberName = "responseHeader",
10929 #endif
10930  .namespaceZero = true,
10931  .padding = 0,
10932  .isArray = false
10933  },
10934  { .memberTypeIndex = UA_TYPES_STATUSCODE,
10935 #ifdef UA_ENABLE_TYPENAMES
10936  .memberName = "results",
10937 #endif
10938  .namespaceZero = true,
10939  .padding = offsetof(UA_DeleteReferencesResponse, resultsSize) - offsetof(UA_DeleteReferencesResponse, responseHeader) - sizeof(UA_ResponseHeader),
10940  .isArray = true
10941  },
10942  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
10943 #ifdef UA_ENABLE_TYPENAMES
10944  .memberName = "diagnosticInfos",
10945 #endif
10946  .namespaceZero = true,
10947  .padding = offsetof(UA_DeleteReferencesResponse, diagnosticInfosSize) - offsetof(UA_DeleteReferencesResponse, results) - sizeof(void*),
10948  .isArray = true
10949  },};
10950 
10951 /* CreateMonitoredItemsResponse */
10952 static UA_DataTypeMember CreateMonitoredItemsResponse_members[3] = {
10954 #ifdef UA_ENABLE_TYPENAMES
10955  .memberName = "responseHeader",
10956 #endif
10957  .namespaceZero = true,
10958  .padding = 0,
10959  .isArray = false
10960  },
10961  { .memberTypeIndex = UA_TYPES_MONITOREDITEMCREATERESULT,
10962 #ifdef UA_ENABLE_TYPENAMES
10963  .memberName = "results",
10964 #endif
10965  .namespaceZero = true,
10966  .padding = offsetof(UA_CreateMonitoredItemsResponse, resultsSize) - offsetof(UA_CreateMonitoredItemsResponse, responseHeader) - sizeof(UA_ResponseHeader),
10967  .isArray = true
10968  },
10969  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
10970 #ifdef UA_ENABLE_TYPENAMES
10971  .memberName = "diagnosticInfos",
10972 #endif
10973  .namespaceZero = true,
10974  .padding = offsetof(UA_CreateMonitoredItemsResponse, diagnosticInfosSize) - offsetof(UA_CreateMonitoredItemsResponse, results) - sizeof(void*),
10975  .isArray = true
10976  },};
10977 
10978 /* CallResponse */
10979 static UA_DataTypeMember CallResponse_members[3] = {
10981 #ifdef UA_ENABLE_TYPENAMES
10982  .memberName = "responseHeader",
10983 #endif
10984  .namespaceZero = true,
10985  .padding = 0,
10986  .isArray = false
10987  },
10988  { .memberTypeIndex = UA_TYPES_CALLMETHODRESULT,
10989 #ifdef UA_ENABLE_TYPENAMES
10990  .memberName = "results",
10991 #endif
10992  .namespaceZero = true,
10993  .padding = offsetof(UA_CallResponse, resultsSize) - offsetof(UA_CallResponse, responseHeader) - sizeof(UA_ResponseHeader),
10994  .isArray = true
10995  },
10996  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
10997 #ifdef UA_ENABLE_TYPENAMES
10998  .memberName = "diagnosticInfos",
10999 #endif
11000  .namespaceZero = true,
11001  .padding = offsetof(UA_CallResponse, diagnosticInfosSize) - offsetof(UA_CallResponse, results) - sizeof(void*),
11002  .isArray = true
11003  },};
11004 
11005 /* DeleteNodesResponse */
11006 static UA_DataTypeMember DeleteNodesResponse_members[3] = {
11008 #ifdef UA_ENABLE_TYPENAMES
11009  .memberName = "responseHeader",
11010 #endif
11011  .namespaceZero = true,
11012  .padding = 0,
11013  .isArray = false
11014  },
11015  { .memberTypeIndex = UA_TYPES_STATUSCODE,
11016 #ifdef UA_ENABLE_TYPENAMES
11017  .memberName = "results",
11018 #endif
11019  .namespaceZero = true,
11020  .padding = offsetof(UA_DeleteNodesResponse, resultsSize) - offsetof(UA_DeleteNodesResponse, responseHeader) - sizeof(UA_ResponseHeader),
11021  .isArray = true
11022  },
11023  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
11024 #ifdef UA_ENABLE_TYPENAMES
11025  .memberName = "diagnosticInfos",
11026 #endif
11027  .namespaceZero = true,
11028  .padding = offsetof(UA_DeleteNodesResponse, diagnosticInfosSize) - offsetof(UA_DeleteNodesResponse, results) - sizeof(void*),
11029  .isArray = true
11030  },};
11031 
11032 /* RepublishResponse */
11033 static UA_DataTypeMember RepublishResponse_members[2] = {
11035 #ifdef UA_ENABLE_TYPENAMES
11036  .memberName = "responseHeader",
11037 #endif
11038  .namespaceZero = true,
11039  .padding = 0,
11040  .isArray = false
11041  },
11042  { .memberTypeIndex = UA_TYPES_NOTIFICATIONMESSAGE,
11043 #ifdef UA_ENABLE_TYPENAMES
11044  .memberName = "notificationMessage",
11045 #endif
11046  .namespaceZero = true,
11047  .padding = offsetof(UA_RepublishResponse, notificationMessage) - offsetof(UA_RepublishResponse, responseHeader) - sizeof(UA_ResponseHeader),
11048  .isArray = false
11049  },};
11050 
11051 /* MonitoredItemCreateRequest */
11052 static UA_DataTypeMember MonitoredItemCreateRequest_members[3] = {
11054 #ifdef UA_ENABLE_TYPENAMES
11055  .memberName = "itemToMonitor",
11056 #endif
11057  .namespaceZero = true,
11058  .padding = 0,
11059  .isArray = false
11060  },
11061  { .memberTypeIndex = UA_TYPES_MONITORINGMODE,
11062 #ifdef UA_ENABLE_TYPENAMES
11063  .memberName = "monitoringMode",
11064 #endif
11065  .namespaceZero = true,
11066  .padding = offsetof(UA_MonitoredItemCreateRequest, monitoringMode) - offsetof(UA_MonitoredItemCreateRequest, itemToMonitor) - sizeof(UA_ReadValueId),
11067  .isArray = false
11068  },
11069  { .memberTypeIndex = UA_TYPES_MONITORINGPARAMETERS,
11070 #ifdef UA_ENABLE_TYPENAMES
11071  .memberName = "requestedParameters",
11072 #endif
11073  .namespaceZero = true,
11074  .padding = offsetof(UA_MonitoredItemCreateRequest, requestedParameters) - offsetof(UA_MonitoredItemCreateRequest, monitoringMode) - sizeof(UA_MonitoringMode),
11075  .isArray = false
11076  },};
11077 
11078 /* DeleteReferencesRequest */
11079 static UA_DataTypeMember DeleteReferencesRequest_members[2] = {
11081 #ifdef UA_ENABLE_TYPENAMES
11082  .memberName = "requestHeader",
11083 #endif
11084  .namespaceZero = true,
11085  .padding = 0,
11086  .isArray = false
11087  },
11088  { .memberTypeIndex = UA_TYPES_DELETEREFERENCESITEM,
11089 #ifdef UA_ENABLE_TYPENAMES
11090  .memberName = "referencesToDelete",
11091 #endif
11092  .namespaceZero = true,
11093  .padding = offsetof(UA_DeleteReferencesRequest, referencesToDeleteSize) - offsetof(UA_DeleteReferencesRequest, requestHeader) - sizeof(UA_RequestHeader),
11094  .isArray = true
11095  },};
11096 
11097 /* ModifyMonitoredItemsResponse */
11098 static UA_DataTypeMember ModifyMonitoredItemsResponse_members[3] = {
11100 #ifdef UA_ENABLE_TYPENAMES
11101  .memberName = "responseHeader",
11102 #endif
11103  .namespaceZero = true,
11104  .padding = 0,
11105  .isArray = false
11106  },
11107  { .memberTypeIndex = UA_TYPES_MONITOREDITEMMODIFYRESULT,
11108 #ifdef UA_ENABLE_TYPENAMES
11109  .memberName = "results",
11110 #endif
11111  .namespaceZero = true,
11112  .padding = offsetof(UA_ModifyMonitoredItemsResponse, resultsSize) - offsetof(UA_ModifyMonitoredItemsResponse, responseHeader) - sizeof(UA_ResponseHeader),
11113  .isArray = true
11114  },
11115  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
11116 #ifdef UA_ENABLE_TYPENAMES
11117  .memberName = "diagnosticInfos",
11118 #endif
11119  .namespaceZero = true,
11120  .padding = offsetof(UA_ModifyMonitoredItemsResponse, diagnosticInfosSize) - offsetof(UA_ModifyMonitoredItemsResponse, results) - sizeof(void*),
11121  .isArray = true
11122  },};
11123 
11124 /* ReadResponse */
11125 static UA_DataTypeMember ReadResponse_members[3] = {
11127 #ifdef UA_ENABLE_TYPENAMES
11128  .memberName = "responseHeader",
11129 #endif
11130  .namespaceZero = true,
11131  .padding = 0,
11132  .isArray = false
11133  },
11134  { .memberTypeIndex = UA_TYPES_DATAVALUE,
11135 #ifdef UA_ENABLE_TYPENAMES
11136  .memberName = "results",
11137 #endif
11138  .namespaceZero = true,
11139  .padding = offsetof(UA_ReadResponse, resultsSize) - offsetof(UA_ReadResponse, responseHeader) - sizeof(UA_ResponseHeader),
11140  .isArray = true
11141  },
11142  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
11143 #ifdef UA_ENABLE_TYPENAMES
11144  .memberName = "diagnosticInfos",
11145 #endif
11146  .namespaceZero = true,
11147  .padding = offsetof(UA_ReadResponse, diagnosticInfosSize) - offsetof(UA_ReadResponse, results) - sizeof(void*),
11148  .isArray = true
11149  },};
11150 
11151 /* AddReferencesRequest */
11152 static UA_DataTypeMember AddReferencesRequest_members[2] = {
11154 #ifdef UA_ENABLE_TYPENAMES
11155  .memberName = "requestHeader",
11156 #endif
11157  .namespaceZero = true,
11158  .padding = 0,
11159  .isArray = false
11160  },
11161  { .memberTypeIndex = UA_TYPES_ADDREFERENCESITEM,
11162 #ifdef UA_ENABLE_TYPENAMES
11163  .memberName = "referencesToAdd",
11164 #endif
11165  .namespaceZero = true,
11166  .padding = offsetof(UA_AddReferencesRequest, referencesToAddSize) - offsetof(UA_AddReferencesRequest, requestHeader) - sizeof(UA_RequestHeader),
11167  .isArray = true
11168  },};
11169 
11170 /* ReadRequest */
11171 static UA_DataTypeMember ReadRequest_members[4] = {
11173 #ifdef UA_ENABLE_TYPENAMES
11174  .memberName = "requestHeader",
11175 #endif
11176  .namespaceZero = true,
11177  .padding = 0,
11178  .isArray = false
11179  },
11180  { .memberTypeIndex = UA_TYPES_DOUBLE,
11181 #ifdef UA_ENABLE_TYPENAMES
11182  .memberName = "maxAge",
11183 #endif
11184  .namespaceZero = true,
11185  .padding = offsetof(UA_ReadRequest, maxAge) - offsetof(UA_ReadRequest, requestHeader) - sizeof(UA_RequestHeader),
11186  .isArray = false
11187  },
11188  { .memberTypeIndex = UA_TYPES_TIMESTAMPSTORETURN,
11189 #ifdef UA_ENABLE_TYPENAMES
11190  .memberName = "timestampsToReturn",
11191 #endif
11192  .namespaceZero = true,
11193  .padding = offsetof(UA_ReadRequest, timestampsToReturn) - offsetof(UA_ReadRequest, maxAge) - sizeof(UA_Double),
11194  .isArray = false
11195  },
11196  { .memberTypeIndex = UA_TYPES_READVALUEID,
11197 #ifdef UA_ENABLE_TYPENAMES
11198  .memberName = "nodesToRead",
11199 #endif
11200  .namespaceZero = true,
11201  .padding = offsetof(UA_ReadRequest, nodesToReadSize) - offsetof(UA_ReadRequest, timestampsToReturn) - sizeof(UA_TimestampsToReturn),
11202  .isArray = true
11203  },};
11204 
11205 /* AddNodesItem */
11206 static UA_DataTypeMember AddNodesItem_members[7] = {
11208 #ifdef UA_ENABLE_TYPENAMES
11209  .memberName = "parentNodeId",
11210 #endif
11211  .namespaceZero = true,
11212  .padding = 0,
11213  .isArray = false
11214  },
11215  { .memberTypeIndex = UA_TYPES_NODEID,
11216 #ifdef UA_ENABLE_TYPENAMES
11217  .memberName = "referenceTypeId",
11218 #endif
11219  .namespaceZero = true,
11220  .padding = offsetof(UA_AddNodesItem, referenceTypeId) - offsetof(UA_AddNodesItem, parentNodeId) - sizeof(UA_ExpandedNodeId),
11221  .isArray = false
11222  },
11223  { .memberTypeIndex = UA_TYPES_EXPANDEDNODEID,
11224 #ifdef UA_ENABLE_TYPENAMES
11225  .memberName = "requestedNewNodeId",
11226 #endif
11227  .namespaceZero = true,
11228  .padding = offsetof(UA_AddNodesItem, requestedNewNodeId) - offsetof(UA_AddNodesItem, referenceTypeId) - sizeof(UA_NodeId),
11229  .isArray = false
11230  },
11231  { .memberTypeIndex = UA_TYPES_QUALIFIEDNAME,
11232 #ifdef UA_ENABLE_TYPENAMES
11233  .memberName = "browseName",
11234 #endif
11235  .namespaceZero = true,
11236  .padding = offsetof(UA_AddNodesItem, browseName) - offsetof(UA_AddNodesItem, requestedNewNodeId) - sizeof(UA_ExpandedNodeId),
11237  .isArray = false
11238  },
11239  { .memberTypeIndex = UA_TYPES_NODECLASS,
11240 #ifdef UA_ENABLE_TYPENAMES
11241  .memberName = "nodeClass",
11242 #endif
11243  .namespaceZero = true,
11244  .padding = offsetof(UA_AddNodesItem, nodeClass) - offsetof(UA_AddNodesItem, browseName) - sizeof(UA_QualifiedName),
11245  .isArray = false
11246  },
11247  { .memberTypeIndex = UA_TYPES_EXTENSIONOBJECT,
11248 #ifdef UA_ENABLE_TYPENAMES
11249  .memberName = "nodeAttributes",
11250 #endif
11251  .namespaceZero = true,
11252  .padding = offsetof(UA_AddNodesItem, nodeAttributes) - offsetof(UA_AddNodesItem, nodeClass) - sizeof(UA_NodeClass),
11253  .isArray = false
11254  },
11255  { .memberTypeIndex = UA_TYPES_EXPANDEDNODEID,
11256 #ifdef UA_ENABLE_TYPENAMES
11257  .memberName = "typeDefinition",
11258 #endif
11259  .namespaceZero = true,
11260  .padding = offsetof(UA_AddNodesItem, typeDefinition) - offsetof(UA_AddNodesItem, nodeAttributes) - sizeof(UA_ExtensionObject),
11261  .isArray = false
11262  },};
11263 
11264 /* ServerStatusDataType */
11265 static UA_DataTypeMember ServerStatusDataType_members[6] = {
11267 #ifdef UA_ENABLE_TYPENAMES
11268  .memberName = "startTime",
11269 #endif
11270  .namespaceZero = true,
11271  .padding = 0,
11272  .isArray = false
11273  },
11274  { .memberTypeIndex = UA_TYPES_DATETIME,
11275 #ifdef UA_ENABLE_TYPENAMES
11276  .memberName = "currentTime",
11277 #endif
11278  .namespaceZero = true,
11279  .padding = offsetof(UA_ServerStatusDataType, currentTime) - offsetof(UA_ServerStatusDataType, startTime) - sizeof(UA_DateTime),
11280  .isArray = false
11281  },
11282  { .memberTypeIndex = UA_TYPES_SERVERSTATE,
11283 #ifdef UA_ENABLE_TYPENAMES
11284  .memberName = "state",
11285 #endif
11286  .namespaceZero = true,
11287  .padding = offsetof(UA_ServerStatusDataType, state) - offsetof(UA_ServerStatusDataType, currentTime) - sizeof(UA_DateTime),
11288  .isArray = false
11289  },
11290  { .memberTypeIndex = UA_TYPES_BUILDINFO,
11291 #ifdef UA_ENABLE_TYPENAMES
11292  .memberName = "buildInfo",
11293 #endif
11294  .namespaceZero = true,
11295  .padding = offsetof(UA_ServerStatusDataType, buildInfo) - offsetof(UA_ServerStatusDataType, state) - sizeof(UA_ServerState),
11296  .isArray = false
11297  },
11298  { .memberTypeIndex = UA_TYPES_UINT32,
11299 #ifdef UA_ENABLE_TYPENAMES
11300  .memberName = "secondsTillShutdown",
11301 #endif
11302  .namespaceZero = true,
11303  .padding = offsetof(UA_ServerStatusDataType, secondsTillShutdown) - offsetof(UA_ServerStatusDataType, buildInfo) - sizeof(UA_BuildInfo),
11304  .isArray = false
11305  },
11306  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
11307 #ifdef UA_ENABLE_TYPENAMES
11308  .memberName = "shutdownReason",
11309 #endif
11310  .namespaceZero = true,
11311  .padding = offsetof(UA_ServerStatusDataType, shutdownReason) - offsetof(UA_ServerStatusDataType, secondsTillShutdown) - sizeof(UA_UInt32),
11312  .isArray = false
11313  },};
11314 
11315 /* AddReferencesResponse */
11316 static UA_DataTypeMember AddReferencesResponse_members[3] = {
11318 #ifdef UA_ENABLE_TYPENAMES
11319  .memberName = "responseHeader",
11320 #endif
11321  .namespaceZero = true,
11322  .padding = 0,
11323  .isArray = false
11324  },
11325  { .memberTypeIndex = UA_TYPES_STATUSCODE,
11326 #ifdef UA_ENABLE_TYPENAMES
11327  .memberName = "results",
11328 #endif
11329  .namespaceZero = true,
11330  .padding = offsetof(UA_AddReferencesResponse, resultsSize) - offsetof(UA_AddReferencesResponse, responseHeader) - sizeof(UA_ResponseHeader),
11331  .isArray = true
11332  },
11333  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
11334 #ifdef UA_ENABLE_TYPENAMES
11335  .memberName = "diagnosticInfos",
11336 #endif
11337  .namespaceZero = true,
11338  .padding = offsetof(UA_AddReferencesResponse, diagnosticInfosSize) - offsetof(UA_AddReferencesResponse, results) - sizeof(void*),
11339  .isArray = true
11340  },};
11341 
11342 /* TranslateBrowsePathsToNodeIdsResponse */
11343 static UA_DataTypeMember TranslateBrowsePathsToNodeIdsResponse_members[3] = {
11345 #ifdef UA_ENABLE_TYPENAMES
11346  .memberName = "responseHeader",
11347 #endif
11348  .namespaceZero = true,
11349  .padding = 0,
11350  .isArray = false
11351  },
11352  { .memberTypeIndex = UA_TYPES_BROWSEPATHRESULT,
11353 #ifdef UA_ENABLE_TYPENAMES
11354  .memberName = "results",
11355 #endif
11356  .namespaceZero = true,
11357  .padding = offsetof(UA_TranslateBrowsePathsToNodeIdsResponse, resultsSize) - offsetof(UA_TranslateBrowsePathsToNodeIdsResponse, responseHeader) - sizeof(UA_ResponseHeader),
11358  .isArray = true
11359  },
11360  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
11361 #ifdef UA_ENABLE_TYPENAMES
11362  .memberName = "diagnosticInfos",
11363 #endif
11364  .namespaceZero = true,
11365  .padding = offsetof(UA_TranslateBrowsePathsToNodeIdsResponse, diagnosticInfosSize) - offsetof(UA_TranslateBrowsePathsToNodeIdsResponse, results) - sizeof(void*),
11366  .isArray = true
11367  },};
11368 
11369 /* DataChangeFilter */
11370 static UA_DataTypeMember DataChangeFilter_members[3] = {
11372 #ifdef UA_ENABLE_TYPENAMES
11373  .memberName = "trigger",
11374 #endif
11375  .namespaceZero = true,
11376  .padding = 0,
11377  .isArray = false
11378  },
11379  { .memberTypeIndex = UA_TYPES_UINT32,
11380 #ifdef UA_ENABLE_TYPENAMES
11381  .memberName = "deadbandType",
11382 #endif
11383  .namespaceZero = true,
11384  .padding = offsetof(UA_DataChangeFilter, deadbandType) - offsetof(UA_DataChangeFilter, trigger) - sizeof(UA_DataChangeTrigger),
11385  .isArray = false
11386  },
11387  { .memberTypeIndex = UA_TYPES_DOUBLE,
11388 #ifdef UA_ENABLE_TYPENAMES
11389  .memberName = "deadbandValue",
11390 #endif
11391  .namespaceZero = true,
11392  .padding = offsetof(UA_DataChangeFilter, deadbandValue) - offsetof(UA_DataChangeFilter, deadbandType) - sizeof(UA_UInt32),
11393  .isArray = false
11394  },};
11395 
11396 /* ContentFilterElement */
11397 static UA_DataTypeMember ContentFilterElement_members[2] = {
11399 #ifdef UA_ENABLE_TYPENAMES
11400  .memberName = "filterOperator",
11401 #endif
11402  .namespaceZero = true,
11403  .padding = 0,
11404  .isArray = false
11405  },
11406  { .memberTypeIndex = UA_TYPES_EXTENSIONOBJECT,
11407 #ifdef UA_ENABLE_TYPENAMES
11408  .memberName = "filterOperands",
11409 #endif
11410  .namespaceZero = true,
11411  .padding = offsetof(UA_ContentFilterElement, filterOperandsSize) - offsetof(UA_ContentFilterElement, filterOperator) - sizeof(UA_FilterOperator),
11412  .isArray = true
11413  },};
11414 
11415 /* CloseSessionResponse */
11416 static UA_DataTypeMember CloseSessionResponse_members[1] = {
11418 #ifdef UA_ENABLE_TYPENAMES
11419  .memberName = "responseHeader",
11420 #endif
11421  .namespaceZero = true,
11422  .padding = 0,
11423  .isArray = false
11424  },};
11425 
11426 /* ApplicationDescription */
11427 static UA_DataTypeMember ApplicationDescription_members[7] = {
11429 #ifdef UA_ENABLE_TYPENAMES
11430  .memberName = "applicationUri",
11431 #endif
11432  .namespaceZero = true,
11433  .padding = 0,
11434  .isArray = false
11435  },
11436  { .memberTypeIndex = UA_TYPES_STRING,
11437 #ifdef UA_ENABLE_TYPENAMES
11438  .memberName = "productUri",
11439 #endif
11440  .namespaceZero = true,
11441  .padding = offsetof(UA_ApplicationDescription, productUri) - offsetof(UA_ApplicationDescription, applicationUri) - sizeof(UA_String),
11442  .isArray = false
11443  },
11444  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
11445 #ifdef UA_ENABLE_TYPENAMES
11446  .memberName = "applicationName",
11447 #endif
11448  .namespaceZero = true,
11449  .padding = offsetof(UA_ApplicationDescription, applicationName) - offsetof(UA_ApplicationDescription, productUri) - sizeof(UA_String),
11450  .isArray = false
11451  },
11452  { .memberTypeIndex = UA_TYPES_APPLICATIONTYPE,
11453 #ifdef UA_ENABLE_TYPENAMES
11454  .memberName = "applicationType",
11455 #endif
11456  .namespaceZero = true,
11457  .padding = offsetof(UA_ApplicationDescription, applicationType) - offsetof(UA_ApplicationDescription, applicationName) - sizeof(UA_LocalizedText),
11458  .isArray = false
11459  },
11460  { .memberTypeIndex = UA_TYPES_STRING,
11461 #ifdef UA_ENABLE_TYPENAMES
11462  .memberName = "gatewayServerUri",
11463 #endif
11464  .namespaceZero = true,
11465  .padding = offsetof(UA_ApplicationDescription, gatewayServerUri) - offsetof(UA_ApplicationDescription, applicationType) - sizeof(UA_ApplicationType),
11466  .isArray = false
11467  },
11468  { .memberTypeIndex = UA_TYPES_STRING,
11469 #ifdef UA_ENABLE_TYPENAMES
11470  .memberName = "discoveryProfileUri",
11471 #endif
11472  .namespaceZero = true,
11473  .padding = offsetof(UA_ApplicationDescription, discoveryProfileUri) - offsetof(UA_ApplicationDescription, gatewayServerUri) - sizeof(UA_String),
11474  .isArray = false
11475  },
11476  { .memberTypeIndex = UA_TYPES_STRING,
11477 #ifdef UA_ENABLE_TYPENAMES
11478  .memberName = "discoveryUrls",
11479 #endif
11480  .namespaceZero = true,
11481  .padding = offsetof(UA_ApplicationDescription, discoveryUrlsSize) - offsetof(UA_ApplicationDescription, discoveryProfileUri) - sizeof(UA_String),
11482  .isArray = true
11483  },};
11484 
11485 /* ServiceFault */
11486 static UA_DataTypeMember ServiceFault_members[1] = {
11488 #ifdef UA_ENABLE_TYPENAMES
11489  .memberName = "responseHeader",
11490 #endif
11491  .namespaceZero = true,
11492  .padding = 0,
11493  .isArray = false
11494  },};
11495 
11496 /* FindServersResponse */
11497 static UA_DataTypeMember FindServersResponse_members[2] = {
11499 #ifdef UA_ENABLE_TYPENAMES
11500  .memberName = "responseHeader",
11501 #endif
11502  .namespaceZero = true,
11503  .padding = 0,
11504  .isArray = false
11505  },
11506  { .memberTypeIndex = UA_TYPES_APPLICATIONDESCRIPTION,
11507 #ifdef UA_ENABLE_TYPENAMES
11508  .memberName = "servers",
11509 #endif
11510  .namespaceZero = true,
11511  .padding = offsetof(UA_FindServersResponse, serversSize) - offsetof(UA_FindServersResponse, responseHeader) - sizeof(UA_ResponseHeader),
11512  .isArray = true
11513  },};
11514 
11515 /* CreateMonitoredItemsRequest */
11516 static UA_DataTypeMember CreateMonitoredItemsRequest_members[4] = {
11518 #ifdef UA_ENABLE_TYPENAMES
11519  .memberName = "requestHeader",
11520 #endif
11521  .namespaceZero = true,
11522  .padding = 0,
11523  .isArray = false
11524  },
11525  { .memberTypeIndex = UA_TYPES_UINT32,
11526 #ifdef UA_ENABLE_TYPENAMES
11527  .memberName = "subscriptionId",
11528 #endif
11529  .namespaceZero = true,
11530  .padding = offsetof(UA_CreateMonitoredItemsRequest, subscriptionId) - offsetof(UA_CreateMonitoredItemsRequest, requestHeader) - sizeof(UA_RequestHeader),
11531  .isArray = false
11532  },
11533  { .memberTypeIndex = UA_TYPES_TIMESTAMPSTORETURN,
11534 #ifdef UA_ENABLE_TYPENAMES
11535  .memberName = "timestampsToReturn",
11536 #endif
11537  .namespaceZero = true,
11538  .padding = offsetof(UA_CreateMonitoredItemsRequest, timestampsToReturn) - offsetof(UA_CreateMonitoredItemsRequest, subscriptionId) - sizeof(UA_UInt32),
11539  .isArray = false
11540  },
11541  { .memberTypeIndex = UA_TYPES_MONITOREDITEMCREATEREQUEST,
11542 #ifdef UA_ENABLE_TYPENAMES
11543  .memberName = "itemsToCreate",
11544 #endif
11545  .namespaceZero = true,
11546  .padding = offsetof(UA_CreateMonitoredItemsRequest, itemsToCreateSize) - offsetof(UA_CreateMonitoredItemsRequest, timestampsToReturn) - sizeof(UA_TimestampsToReturn),
11547  .isArray = true
11548  },};
11549 
11550 /* ContentFilter */
11551 static UA_DataTypeMember ContentFilter_members[1] = {
11553 #ifdef UA_ENABLE_TYPENAMES
11554  .memberName = "elements",
11555 #endif
11556  .namespaceZero = true,
11557  .padding = 0,
11558  .isArray = true
11559  },};
11560 
11561 /* QueryFirstResponse */
11562 static UA_DataTypeMember QueryFirstResponse_members[6] = {
11564 #ifdef UA_ENABLE_TYPENAMES
11565  .memberName = "responseHeader",
11566 #endif
11567  .namespaceZero = true,
11568  .padding = 0,
11569  .isArray = false
11570  },
11571  { .memberTypeIndex = UA_TYPES_QUERYDATASET,
11572 #ifdef UA_ENABLE_TYPENAMES
11573  .memberName = "queryDataSets",
11574 #endif
11575  .namespaceZero = true,
11576  .padding = offsetof(UA_QueryFirstResponse, queryDataSetsSize) - offsetof(UA_QueryFirstResponse, responseHeader) - sizeof(UA_ResponseHeader),
11577  .isArray = true
11578  },
11579  { .memberTypeIndex = UA_TYPES_BYTESTRING,
11580 #ifdef UA_ENABLE_TYPENAMES
11581  .memberName = "continuationPoint",
11582 #endif
11583  .namespaceZero = true,
11584  .padding = offsetof(UA_QueryFirstResponse, continuationPoint) - offsetof(UA_QueryFirstResponse, queryDataSets) - sizeof(void*),
11585  .isArray = false
11586  },
11587  { .memberTypeIndex = UA_TYPES_PARSINGRESULT,
11588 #ifdef UA_ENABLE_TYPENAMES
11589  .memberName = "parsingResults",
11590 #endif
11591  .namespaceZero = true,
11592  .padding = offsetof(UA_QueryFirstResponse, parsingResultsSize) - offsetof(UA_QueryFirstResponse, continuationPoint) - sizeof(UA_ByteString),
11593  .isArray = true
11594  },
11595  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
11596 #ifdef UA_ENABLE_TYPENAMES
11597  .memberName = "diagnosticInfos",
11598 #endif
11599  .namespaceZero = true,
11600  .padding = offsetof(UA_QueryFirstResponse, diagnosticInfosSize) - offsetof(UA_QueryFirstResponse, parsingResults) - sizeof(void*),
11601  .isArray = true
11602  },
11603  { .memberTypeIndex = UA_TYPES_CONTENTFILTERRESULT,
11604 #ifdef UA_ENABLE_TYPENAMES
11605  .memberName = "filterResult",
11606 #endif
11607  .namespaceZero = true,
11608  .padding = offsetof(UA_QueryFirstResponse, filterResult) - offsetof(UA_QueryFirstResponse, diagnosticInfos) - sizeof(void*),
11609  .isArray = false
11610  },};
11611 
11612 /* AddNodesRequest */
11613 static UA_DataTypeMember AddNodesRequest_members[2] = {
11615 #ifdef UA_ENABLE_TYPENAMES
11616  .memberName = "requestHeader",
11617 #endif
11618  .namespaceZero = true,
11619  .padding = 0,
11620  .isArray = false
11621  },
11622  { .memberTypeIndex = UA_TYPES_ADDNODESITEM,
11623 #ifdef UA_ENABLE_TYPENAMES
11624  .memberName = "nodesToAdd",
11625 #endif
11626  .namespaceZero = true,
11627  .padding = offsetof(UA_AddNodesRequest, nodesToAddSize) - offsetof(UA_AddNodesRequest, requestHeader) - sizeof(UA_RequestHeader),
11628  .isArray = true
11629  },};
11630 
11631 /* BrowseRequest */
11632 static UA_DataTypeMember BrowseRequest_members[4] = {
11634 #ifdef UA_ENABLE_TYPENAMES
11635  .memberName = "requestHeader",
11636 #endif
11637  .namespaceZero = true,
11638  .padding = 0,
11639  .isArray = false
11640  },
11641  { .memberTypeIndex = UA_TYPES_VIEWDESCRIPTION,
11642 #ifdef UA_ENABLE_TYPENAMES
11643  .memberName = "view",
11644 #endif
11645  .namespaceZero = true,
11646  .padding = offsetof(UA_BrowseRequest, view) - offsetof(UA_BrowseRequest, requestHeader) - sizeof(UA_RequestHeader),
11647  .isArray = false
11648  },
11649  { .memberTypeIndex = UA_TYPES_UINT32,
11650 #ifdef UA_ENABLE_TYPENAMES
11651  .memberName = "requestedMaxReferencesPerNode",
11652 #endif
11653  .namespaceZero = true,
11654  .padding = offsetof(UA_BrowseRequest, requestedMaxReferencesPerNode) - offsetof(UA_BrowseRequest, view) - sizeof(UA_ViewDescription),
11655  .isArray = false
11656  },
11657  { .memberTypeIndex = UA_TYPES_BROWSEDESCRIPTION,
11658 #ifdef UA_ENABLE_TYPENAMES
11659  .memberName = "nodesToBrowse",
11660 #endif
11661  .namespaceZero = true,
11662  .padding = offsetof(UA_BrowseRequest, nodesToBrowseSize) - offsetof(UA_BrowseRequest, requestedMaxReferencesPerNode) - sizeof(UA_UInt32),
11663  .isArray = true
11664  },};
11665 
11666 /* BrowsePath */
11667 static UA_DataTypeMember BrowsePath_members[2] = {
11669 #ifdef UA_ENABLE_TYPENAMES
11670  .memberName = "startingNode",
11671 #endif
11672  .namespaceZero = true,
11673  .padding = 0,
11674  .isArray = false
11675  },
11676  { .memberTypeIndex = UA_TYPES_RELATIVEPATH,
11677 #ifdef UA_ENABLE_TYPENAMES
11678  .memberName = "relativePath",
11679 #endif
11680  .namespaceZero = true,
11681  .padding = offsetof(UA_BrowsePath, relativePath) - offsetof(UA_BrowsePath, startingNode) - sizeof(UA_NodeId),
11682  .isArray = false
11683  },};
11684 
11685 /* BrowseResult */
11686 static UA_DataTypeMember BrowseResult_members[3] = {
11688 #ifdef UA_ENABLE_TYPENAMES
11689  .memberName = "statusCode",
11690 #endif
11691  .namespaceZero = true,
11692  .padding = 0,
11693  .isArray = false
11694  },
11695  { .memberTypeIndex = UA_TYPES_BYTESTRING,
11696 #ifdef UA_ENABLE_TYPENAMES
11697  .memberName = "continuationPoint",
11698 #endif
11699  .namespaceZero = true,
11700  .padding = offsetof(UA_BrowseResult, continuationPoint) - offsetof(UA_BrowseResult, statusCode) - sizeof(UA_StatusCode),
11701  .isArray = false
11702  },
11703  { .memberTypeIndex = UA_TYPES_REFERENCEDESCRIPTION,
11704 #ifdef UA_ENABLE_TYPENAMES
11705  .memberName = "references",
11706 #endif
11707  .namespaceZero = true,
11708  .padding = offsetof(UA_BrowseResult, referencesSize) - offsetof(UA_BrowseResult, continuationPoint) - sizeof(UA_ByteString),
11709  .isArray = true
11710  },};
11711 
11712 /* CreateSessionRequest */
11713 static UA_DataTypeMember CreateSessionRequest_members[9] = {
11715 #ifdef UA_ENABLE_TYPENAMES
11716  .memberName = "requestHeader",
11717 #endif
11718  .namespaceZero = true,
11719  .padding = 0,
11720  .isArray = false
11721  },
11722  { .memberTypeIndex = UA_TYPES_APPLICATIONDESCRIPTION,
11723 #ifdef UA_ENABLE_TYPENAMES
11724  .memberName = "clientDescription",
11725 #endif
11726  .namespaceZero = true,
11727  .padding = offsetof(UA_CreateSessionRequest, clientDescription) - offsetof(UA_CreateSessionRequest, requestHeader) - sizeof(UA_RequestHeader),
11728  .isArray = false
11729  },
11730  { .memberTypeIndex = UA_TYPES_STRING,
11731 #ifdef UA_ENABLE_TYPENAMES
11732  .memberName = "serverUri",
11733 #endif
11734  .namespaceZero = true,
11735  .padding = offsetof(UA_CreateSessionRequest, serverUri) - offsetof(UA_CreateSessionRequest, clientDescription) - sizeof(UA_ApplicationDescription),
11736  .isArray = false
11737  },
11738  { .memberTypeIndex = UA_TYPES_STRING,
11739 #ifdef UA_ENABLE_TYPENAMES
11740  .memberName = "endpointUrl",
11741 #endif
11742  .namespaceZero = true,
11743  .padding = offsetof(UA_CreateSessionRequest, endpointUrl) - offsetof(UA_CreateSessionRequest, serverUri) - sizeof(UA_String),
11744  .isArray = false
11745  },
11746  { .memberTypeIndex = UA_TYPES_STRING,
11747 #ifdef UA_ENABLE_TYPENAMES
11748  .memberName = "sessionName",
11749 #endif
11750  .namespaceZero = true,
11751  .padding = offsetof(UA_CreateSessionRequest, sessionName) - offsetof(UA_CreateSessionRequest, endpointUrl) - sizeof(UA_String),
11752  .isArray = false
11753  },
11754  { .memberTypeIndex = UA_TYPES_BYTESTRING,
11755 #ifdef UA_ENABLE_TYPENAMES
11756  .memberName = "clientNonce",
11757 #endif
11758  .namespaceZero = true,
11759  .padding = offsetof(UA_CreateSessionRequest, clientNonce) - offsetof(UA_CreateSessionRequest, sessionName) - sizeof(UA_String),
11760  .isArray = false
11761  },
11762  { .memberTypeIndex = UA_TYPES_BYTESTRING,
11763 #ifdef UA_ENABLE_TYPENAMES
11764  .memberName = "clientCertificate",
11765 #endif
11766  .namespaceZero = true,
11767  .padding = offsetof(UA_CreateSessionRequest, clientCertificate) - offsetof(UA_CreateSessionRequest, clientNonce) - sizeof(UA_ByteString),
11768  .isArray = false
11769  },
11770  { .memberTypeIndex = UA_TYPES_DOUBLE,
11771 #ifdef UA_ENABLE_TYPENAMES
11772  .memberName = "requestedSessionTimeout",
11773 #endif
11774  .namespaceZero = true,
11775  .padding = offsetof(UA_CreateSessionRequest, requestedSessionTimeout) - offsetof(UA_CreateSessionRequest, clientCertificate) - sizeof(UA_ByteString),
11776  .isArray = false
11777  },
11778  { .memberTypeIndex = UA_TYPES_UINT32,
11779 #ifdef UA_ENABLE_TYPENAMES
11780  .memberName = "maxResponseMessageSize",
11781 #endif
11782  .namespaceZero = true,
11783  .padding = offsetof(UA_CreateSessionRequest, maxResponseMessageSize) - offsetof(UA_CreateSessionRequest, requestedSessionTimeout) - sizeof(UA_Double),
11784  .isArray = false
11785  },};
11786 
11787 /* QueryDataDescription */
11788 static UA_DataTypeMember QueryDataDescription_members[3] = {
11790 #ifdef UA_ENABLE_TYPENAMES
11791  .memberName = "relativePath",
11792 #endif
11793  .namespaceZero = true,
11794  .padding = 0,
11795  .isArray = false
11796  },
11797  { .memberTypeIndex = UA_TYPES_UINT32,
11798 #ifdef UA_ENABLE_TYPENAMES
11799  .memberName = "attributeId",
11800 #endif
11801  .namespaceZero = true,
11802  .padding = offsetof(UA_QueryDataDescription, attributeId) - offsetof(UA_QueryDataDescription, relativePath) - sizeof(UA_RelativePath),
11803  .isArray = false
11804  },
11805  { .memberTypeIndex = UA_TYPES_STRING,
11806 #ifdef UA_ENABLE_TYPENAMES
11807  .memberName = "indexRange",
11808 #endif
11809  .namespaceZero = true,
11810  .padding = offsetof(UA_QueryDataDescription, indexRange) - offsetof(UA_QueryDataDescription, attributeId) - sizeof(UA_UInt32),
11811  .isArray = false
11812  },};
11813 
11814 /* EndpointDescription */
11815 static UA_DataTypeMember EndpointDescription_members[8] = {
11817 #ifdef UA_ENABLE_TYPENAMES
11818  .memberName = "endpointUrl",
11819 #endif
11820  .namespaceZero = true,
11821  .padding = 0,
11822  .isArray = false
11823  },
11824  { .memberTypeIndex = UA_TYPES_APPLICATIONDESCRIPTION,
11825 #ifdef UA_ENABLE_TYPENAMES
11826  .memberName = "server",
11827 #endif
11828  .namespaceZero = true,
11829  .padding = offsetof(UA_EndpointDescription, server) - offsetof(UA_EndpointDescription, endpointUrl) - sizeof(UA_String),
11830  .isArray = false
11831  },
11832  { .memberTypeIndex = UA_TYPES_BYTESTRING,
11833 #ifdef UA_ENABLE_TYPENAMES
11834  .memberName = "serverCertificate",
11835 #endif
11836  .namespaceZero = true,
11837  .padding = offsetof(UA_EndpointDescription, serverCertificate) - offsetof(UA_EndpointDescription, server) - sizeof(UA_ApplicationDescription),
11838  .isArray = false
11839  },
11840  { .memberTypeIndex = UA_TYPES_MESSAGESECURITYMODE,
11841 #ifdef UA_ENABLE_TYPENAMES
11842  .memberName = "securityMode",
11843 #endif
11844  .namespaceZero = true,
11845  .padding = offsetof(UA_EndpointDescription, securityMode) - offsetof(UA_EndpointDescription, serverCertificate) - sizeof(UA_ByteString),
11846  .isArray = false
11847  },
11848  { .memberTypeIndex = UA_TYPES_STRING,
11849 #ifdef UA_ENABLE_TYPENAMES
11850  .memberName = "securityPolicyUri",
11851 #endif
11852  .namespaceZero = true,
11853  .padding = offsetof(UA_EndpointDescription, securityPolicyUri) - offsetof(UA_EndpointDescription, securityMode) - sizeof(UA_MessageSecurityMode),
11854  .isArray = false
11855  },
11856  { .memberTypeIndex = UA_TYPES_USERTOKENPOLICY,
11857 #ifdef UA_ENABLE_TYPENAMES
11858  .memberName = "userIdentityTokens",
11859 #endif
11860  .namespaceZero = true,
11861  .padding = offsetof(UA_EndpointDescription, userIdentityTokensSize) - offsetof(UA_EndpointDescription, securityPolicyUri) - sizeof(UA_String),
11862  .isArray = true
11863  },
11864  { .memberTypeIndex = UA_TYPES_STRING,
11865 #ifdef UA_ENABLE_TYPENAMES
11866  .memberName = "transportProfileUri",
11867 #endif
11868  .namespaceZero = true,
11869  .padding = offsetof(UA_EndpointDescription, transportProfileUri) - offsetof(UA_EndpointDescription, userIdentityTokens) - sizeof(void*),
11870  .isArray = false
11871  },
11872  { .memberTypeIndex = UA_TYPES_BYTE,
11873 #ifdef UA_ENABLE_TYPENAMES
11874  .memberName = "securityLevel",
11875 #endif
11876  .namespaceZero = true,
11877  .padding = offsetof(UA_EndpointDescription, securityLevel) - offsetof(UA_EndpointDescription, transportProfileUri) - sizeof(UA_String),
11878  .isArray = false
11879  },};
11880 
11881 /* GetEndpointsResponse */
11882 static UA_DataTypeMember GetEndpointsResponse_members[2] = {
11884 #ifdef UA_ENABLE_TYPENAMES
11885  .memberName = "responseHeader",
11886 #endif
11887  .namespaceZero = true,
11888  .padding = 0,
11889  .isArray = false
11890  },
11891  { .memberTypeIndex = UA_TYPES_ENDPOINTDESCRIPTION,
11892 #ifdef UA_ENABLE_TYPENAMES
11893  .memberName = "endpoints",
11894 #endif
11895  .namespaceZero = true,
11896  .padding = offsetof(UA_GetEndpointsResponse, endpointsSize) - offsetof(UA_GetEndpointsResponse, responseHeader) - sizeof(UA_ResponseHeader),
11897  .isArray = true
11898  },};
11899 
11900 /* NodeTypeDescription */
11901 static UA_DataTypeMember NodeTypeDescription_members[3] = {
11903 #ifdef UA_ENABLE_TYPENAMES
11904  .memberName = "typeDefinitionNode",
11905 #endif
11906  .namespaceZero = true,
11907  .padding = 0,
11908  .isArray = false
11909  },
11910  { .memberTypeIndex = UA_TYPES_BOOLEAN,
11911 #ifdef UA_ENABLE_TYPENAMES
11912  .memberName = "includeSubTypes",
11913 #endif
11914  .namespaceZero = true,
11915  .padding = offsetof(UA_NodeTypeDescription, includeSubTypes) - offsetof(UA_NodeTypeDescription, typeDefinitionNode) - sizeof(UA_ExpandedNodeId),
11916  .isArray = false
11917  },
11918  { .memberTypeIndex = UA_TYPES_QUERYDATADESCRIPTION,
11919 #ifdef UA_ENABLE_TYPENAMES
11920  .memberName = "dataToReturn",
11921 #endif
11922  .namespaceZero = true,
11923  .padding = offsetof(UA_NodeTypeDescription, dataToReturnSize) - offsetof(UA_NodeTypeDescription, includeSubTypes) - sizeof(UA_Boolean),
11924  .isArray = true
11925  },};
11926 
11927 /* BrowseNextResponse */
11928 static UA_DataTypeMember BrowseNextResponse_members[3] = {
11930 #ifdef UA_ENABLE_TYPENAMES
11931  .memberName = "responseHeader",
11932 #endif
11933  .namespaceZero = true,
11934  .padding = 0,
11935  .isArray = false
11936  },
11937  { .memberTypeIndex = UA_TYPES_BROWSERESULT,
11938 #ifdef UA_ENABLE_TYPENAMES
11939  .memberName = "results",
11940 #endif
11941  .namespaceZero = true,
11942  .padding = offsetof(UA_BrowseNextResponse, resultsSize) - offsetof(UA_BrowseNextResponse, responseHeader) - sizeof(UA_ResponseHeader),
11943  .isArray = true
11944  },
11945  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
11946 #ifdef UA_ENABLE_TYPENAMES
11947  .memberName = "diagnosticInfos",
11948 #endif
11949  .namespaceZero = true,
11950  .padding = offsetof(UA_BrowseNextResponse, diagnosticInfosSize) - offsetof(UA_BrowseNextResponse, results) - sizeof(void*),
11951  .isArray = true
11952  },};
11953 
11954 /* TranslateBrowsePathsToNodeIdsRequest */
11955 static UA_DataTypeMember TranslateBrowsePathsToNodeIdsRequest_members[2] = {
11957 #ifdef UA_ENABLE_TYPENAMES
11958  .memberName = "requestHeader",
11959 #endif
11960  .namespaceZero = true,
11961  .padding = 0,
11962  .isArray = false
11963  },
11964  { .memberTypeIndex = UA_TYPES_BROWSEPATH,
11965 #ifdef UA_ENABLE_TYPENAMES
11966  .memberName = "browsePaths",
11967 #endif
11968  .namespaceZero = true,
11969  .padding = offsetof(UA_TranslateBrowsePathsToNodeIdsRequest, browsePathsSize) - offsetof(UA_TranslateBrowsePathsToNodeIdsRequest, requestHeader) - sizeof(UA_RequestHeader),
11970  .isArray = true
11971  },};
11972 
11973 /* BrowseResponse */
11974 static UA_DataTypeMember BrowseResponse_members[3] = {
11976 #ifdef UA_ENABLE_TYPENAMES
11977  .memberName = "responseHeader",
11978 #endif
11979  .namespaceZero = true,
11980  .padding = 0,
11981  .isArray = false
11982  },
11983  { .memberTypeIndex = UA_TYPES_BROWSERESULT,
11984 #ifdef UA_ENABLE_TYPENAMES
11985  .memberName = "results",
11986 #endif
11987  .namespaceZero = true,
11988  .padding = offsetof(UA_BrowseResponse, resultsSize) - offsetof(UA_BrowseResponse, responseHeader) - sizeof(UA_ResponseHeader),
11989  .isArray = true
11990  },
11991  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
11992 #ifdef UA_ENABLE_TYPENAMES
11993  .memberName = "diagnosticInfos",
11994 #endif
11995  .namespaceZero = true,
11996  .padding = offsetof(UA_BrowseResponse, diagnosticInfosSize) - offsetof(UA_BrowseResponse, results) - sizeof(void*),
11997  .isArray = true
11998  },};
11999 
12000 /* CreateSessionResponse */
12001 static UA_DataTypeMember CreateSessionResponse_members[10] = {
12003 #ifdef UA_ENABLE_TYPENAMES
12004  .memberName = "responseHeader",
12005 #endif
12006  .namespaceZero = true,
12007  .padding = 0,
12008  .isArray = false
12009  },
12010  { .memberTypeIndex = UA_TYPES_NODEID,
12011 #ifdef UA_ENABLE_TYPENAMES
12012  .memberName = "sessionId",
12013 #endif
12014  .namespaceZero = true,
12015  .padding = offsetof(UA_CreateSessionResponse, sessionId) - offsetof(UA_CreateSessionResponse, responseHeader) - sizeof(UA_ResponseHeader),
12016  .isArray = false
12017  },
12018  { .memberTypeIndex = UA_TYPES_NODEID,
12019 #ifdef UA_ENABLE_TYPENAMES
12020  .memberName = "authenticationToken",
12021 #endif
12022  .namespaceZero = true,
12023  .padding = offsetof(UA_CreateSessionResponse, authenticationToken) - offsetof(UA_CreateSessionResponse, sessionId) - sizeof(UA_NodeId),
12024  .isArray = false
12025  },
12026  { .memberTypeIndex = UA_TYPES_DOUBLE,
12027 #ifdef UA_ENABLE_TYPENAMES
12028  .memberName = "revisedSessionTimeout",
12029 #endif
12030  .namespaceZero = true,
12031  .padding = offsetof(UA_CreateSessionResponse, revisedSessionTimeout) - offsetof(UA_CreateSessionResponse, authenticationToken) - sizeof(UA_NodeId),
12032  .isArray = false
12033  },
12034  { .memberTypeIndex = UA_TYPES_BYTESTRING,
12035 #ifdef UA_ENABLE_TYPENAMES
12036  .memberName = "serverNonce",
12037 #endif
12038  .namespaceZero = true,
12039  .padding = offsetof(UA_CreateSessionResponse, serverNonce) - offsetof(UA_CreateSessionResponse, revisedSessionTimeout) - sizeof(UA_Double),
12040  .isArray = false
12041  },
12042  { .memberTypeIndex = UA_TYPES_BYTESTRING,
12043 #ifdef UA_ENABLE_TYPENAMES
12044  .memberName = "serverCertificate",
12045 #endif
12046  .namespaceZero = true,
12047  .padding = offsetof(UA_CreateSessionResponse, serverCertificate) - offsetof(UA_CreateSessionResponse, serverNonce) - sizeof(UA_ByteString),
12048  .isArray = false
12049  },
12050  { .memberTypeIndex = UA_TYPES_ENDPOINTDESCRIPTION,
12051 #ifdef UA_ENABLE_TYPENAMES
12052  .memberName = "serverEndpoints",
12053 #endif
12054  .namespaceZero = true,
12055  .padding = offsetof(UA_CreateSessionResponse, serverEndpointsSize) - offsetof(UA_CreateSessionResponse, serverCertificate) - sizeof(UA_ByteString),
12056  .isArray = true
12057  },
12058  { .memberTypeIndex = UA_TYPES_SIGNEDSOFTWARECERTIFICATE,
12059 #ifdef UA_ENABLE_TYPENAMES
12060  .memberName = "serverSoftwareCertificates",
12061 #endif
12062  .namespaceZero = true,
12063  .padding = offsetof(UA_CreateSessionResponse, serverSoftwareCertificatesSize) - offsetof(UA_CreateSessionResponse, serverEndpoints) - sizeof(void*),
12064  .isArray = true
12065  },
12066  { .memberTypeIndex = UA_TYPES_SIGNATUREDATA,
12067 #ifdef UA_ENABLE_TYPENAMES
12068  .memberName = "serverSignature",
12069 #endif
12070  .namespaceZero = true,
12071  .padding = offsetof(UA_CreateSessionResponse, serverSignature) - offsetof(UA_CreateSessionResponse, serverSoftwareCertificates) - sizeof(void*),
12072  .isArray = false
12073  },
12074  { .memberTypeIndex = UA_TYPES_UINT32,
12075 #ifdef UA_ENABLE_TYPENAMES
12076  .memberName = "maxRequestMessageSize",
12077 #endif
12078  .namespaceZero = true,
12079  .padding = offsetof(UA_CreateSessionResponse, maxRequestMessageSize) - offsetof(UA_CreateSessionResponse, serverSignature) - sizeof(UA_SignatureData),
12080  .isArray = false
12081  },};
12082 
12083 /* QueryFirstRequest */
12084 static UA_DataTypeMember QueryFirstRequest_members[6] = {
12086 #ifdef UA_ENABLE_TYPENAMES
12087  .memberName = "requestHeader",
12088 #endif
12089  .namespaceZero = true,
12090  .padding = 0,
12091  .isArray = false
12092  },
12093  { .memberTypeIndex = UA_TYPES_VIEWDESCRIPTION,
12094 #ifdef UA_ENABLE_TYPENAMES
12095  .memberName = "view",
12096 #endif
12097  .namespaceZero = true,
12098  .padding = offsetof(UA_QueryFirstRequest, view) - offsetof(UA_QueryFirstRequest, requestHeader) - sizeof(UA_RequestHeader),
12099  .isArray = false
12100  },
12101  { .memberTypeIndex = UA_TYPES_NODETYPEDESCRIPTION,
12102 #ifdef UA_ENABLE_TYPENAMES
12103  .memberName = "nodeTypes",
12104 #endif
12105  .namespaceZero = true,
12106  .padding = offsetof(UA_QueryFirstRequest, nodeTypesSize) - offsetof(UA_QueryFirstRequest, view) - sizeof(UA_ViewDescription),
12107  .isArray = true
12108  },
12109  { .memberTypeIndex = UA_TYPES_CONTENTFILTER,
12110 #ifdef UA_ENABLE_TYPENAMES
12111  .memberName = "filter",
12112 #endif
12113  .namespaceZero = true,
12114  .padding = offsetof(UA_QueryFirstRequest, filter) - offsetof(UA_QueryFirstRequest, nodeTypes) - sizeof(void*),
12115  .isArray = false
12116  },
12117  { .memberTypeIndex = UA_TYPES_UINT32,
12118 #ifdef UA_ENABLE_TYPENAMES
12119  .memberName = "maxDataSetsToReturn",
12120 #endif
12121  .namespaceZero = true,
12122  .padding = offsetof(UA_QueryFirstRequest, maxDataSetsToReturn) - offsetof(UA_QueryFirstRequest, filter) - sizeof(UA_ContentFilter),
12123  .isArray = false
12124  },
12125  { .memberTypeIndex = UA_TYPES_UINT32,
12126 #ifdef UA_ENABLE_TYPENAMES
12127  .memberName = "maxReferencesToReturn",
12128 #endif
12129  .namespaceZero = true,
12130  .padding = offsetof(UA_QueryFirstRequest, maxReferencesToReturn) - offsetof(UA_QueryFirstRequest, maxDataSetsToReturn) - sizeof(UA_UInt32),
12131  .isArray = false
12132  },};
12134 
12135 /* Boolean */
12136 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 1},
12137  .typeIndex = UA_TYPES_BOOLEAN,
12138 #ifdef UA_ENABLE_TYPENAMES
12139  .typeName = "Boolean",
12140 #endif
12141  .memSize = sizeof(UA_Boolean),
12142  .builtin = true,
12143  .fixedSize = true,
12144  .overlayable = true,
12145  .binaryEncodingId = 0,
12146  .membersSize = 1,
12147  .members = Boolean_members },
12148 
12149 /* SByte */
12150 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 2},
12151  .typeIndex = UA_TYPES_SBYTE,
12152 #ifdef UA_ENABLE_TYPENAMES
12153  .typeName = "SByte",
12154 #endif
12155  .memSize = sizeof(UA_SByte),
12156  .builtin = true,
12157  .fixedSize = true,
12158  .overlayable = true,
12159  .binaryEncodingId = 0,
12160  .membersSize = 1,
12161  .members = SByte_members },
12162 
12163 /* Byte */
12164 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 3},
12165  .typeIndex = UA_TYPES_BYTE,
12166 #ifdef UA_ENABLE_TYPENAMES
12167  .typeName = "Byte",
12168 #endif
12169  .memSize = sizeof(UA_Byte),
12170  .builtin = true,
12171  .fixedSize = true,
12172  .overlayable = true,
12173  .binaryEncodingId = 0,
12174  .membersSize = 1,
12175  .members = Byte_members },
12176 
12177 /* Int16 */
12178 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 4},
12179  .typeIndex = UA_TYPES_INT16,
12180 #ifdef UA_ENABLE_TYPENAMES
12181  .typeName = "Int16",
12182 #endif
12183  .memSize = sizeof(UA_Int16),
12184  .builtin = true,
12185  .fixedSize = true,
12186  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
12187  .binaryEncodingId = 0,
12188  .membersSize = 1,
12189  .members = Int16_members },
12190 
12191 /* UInt16 */
12192 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 5},
12193  .typeIndex = UA_TYPES_UINT16,
12194 #ifdef UA_ENABLE_TYPENAMES
12195  .typeName = "UInt16",
12196 #endif
12197  .memSize = sizeof(UA_UInt16),
12198  .builtin = true,
12199  .fixedSize = true,
12200  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
12201  .binaryEncodingId = 0,
12202  .membersSize = 1,
12203  .members = UInt16_members },
12204 
12205 /* Int32 */
12206 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 6},
12207  .typeIndex = UA_TYPES_INT32,
12208 #ifdef UA_ENABLE_TYPENAMES
12209  .typeName = "Int32",
12210 #endif
12211  .memSize = sizeof(UA_Int32),
12212  .builtin = true,
12213  .fixedSize = true,
12214  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
12215  .binaryEncodingId = 0,
12216  .membersSize = 1,
12217  .members = Int32_members },
12218 
12219 /* UInt32 */
12220 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 7},
12221  .typeIndex = UA_TYPES_UINT32,
12222 #ifdef UA_ENABLE_TYPENAMES
12223  .typeName = "UInt32",
12224 #endif
12225  .memSize = sizeof(UA_UInt32),
12226  .builtin = true,
12227  .fixedSize = true,
12228  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
12229  .binaryEncodingId = 0,
12230  .membersSize = 1,
12231  .members = UInt32_members },
12232 
12233 /* Int64 */
12234 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 8},
12235  .typeIndex = UA_TYPES_INT64,
12236 #ifdef UA_ENABLE_TYPENAMES
12237  .typeName = "Int64",
12238 #endif
12239  .memSize = sizeof(UA_Int64),
12240  .builtin = true,
12241  .fixedSize = true,
12242  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
12243  .binaryEncodingId = 0,
12244  .membersSize = 1,
12245  .members = Int64_members },
12246 
12247 /* UInt64 */
12248 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 9},
12249  .typeIndex = UA_TYPES_UINT64,
12250 #ifdef UA_ENABLE_TYPENAMES
12251  .typeName = "UInt64",
12252 #endif
12253  .memSize = sizeof(UA_UInt64),
12254  .builtin = true,
12255  .fixedSize = true,
12256  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
12257  .binaryEncodingId = 0,
12258  .membersSize = 1,
12259  .members = UInt64_members },
12260 
12261 /* Float */
12262 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 10},
12263  .typeIndex = UA_TYPES_FLOAT,
12264 #ifdef UA_ENABLE_TYPENAMES
12265  .typeName = "Float",
12266 #endif
12267  .memSize = sizeof(UA_Float),
12268  .builtin = true,
12269  .fixedSize = true,
12270  .overlayable = UA_BINARY_OVERLAYABLE_FLOAT,
12271  .binaryEncodingId = 0,
12272  .membersSize = 1,
12273  .members = Float_members },
12274 
12275 /* Double */
12276 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 11},
12277  .typeIndex = UA_TYPES_DOUBLE,
12278 #ifdef UA_ENABLE_TYPENAMES
12279  .typeName = "Double",
12280 #endif
12281  .memSize = sizeof(UA_Double),
12282  .builtin = true,
12283  .fixedSize = true,
12284  .overlayable = UA_BINARY_OVERLAYABLE_FLOAT,
12285  .binaryEncodingId = 0,
12286  .membersSize = 1,
12287  .members = Double_members },
12288 
12289 /* String */
12290 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 12},
12291  .typeIndex = UA_TYPES_STRING,
12292 #ifdef UA_ENABLE_TYPENAMES
12293  .typeName = "String",
12294 #endif
12295  .memSize = sizeof(UA_String),
12296  .builtin = true,
12297  .fixedSize = false,
12298  .overlayable = false,
12299  .binaryEncodingId = 0,
12300  .membersSize = 1,
12301  .members = String_members },
12302 
12303 /* DateTime */
12304 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 13},
12305  .typeIndex = UA_TYPES_DATETIME,
12306 #ifdef UA_ENABLE_TYPENAMES
12307  .typeName = "DateTime",
12308 #endif
12309  .memSize = sizeof(UA_DateTime),
12310  .builtin = true,
12311  .fixedSize = true,
12312  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
12313  .binaryEncodingId = 0,
12314  .membersSize = 1,
12315  .members = DateTime_members },
12316 
12317 /* Guid */
12318 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 14},
12319  .typeIndex = UA_TYPES_GUID,
12320 #ifdef UA_ENABLE_TYPENAMES
12321  .typeName = "Guid",
12322 #endif
12323  .memSize = sizeof(UA_Guid),
12324  .builtin = true,
12325  .fixedSize = true,
12326  .overlayable = (UA_BINARY_OVERLAYABLE_INTEGER && offsetof(UA_Guid, data2) == sizeof(UA_UInt32) && offsetof(UA_Guid, data3) == (sizeof(UA_UInt16) + sizeof(UA_UInt32)) && offsetof(UA_Guid, data4) == (2*sizeof(UA_UInt32))),
12327  .binaryEncodingId = 0,
12328  .membersSize = 1,
12329  .members = Guid_members },
12330 
12331 /* ByteString */
12332 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 15},
12333  .typeIndex = UA_TYPES_BYTESTRING,
12334 #ifdef UA_ENABLE_TYPENAMES
12335  .typeName = "ByteString",
12336 #endif
12337  .memSize = sizeof(UA_ByteString),
12338  .builtin = true,
12339  .fixedSize = false,
12340  .overlayable = false,
12341  .binaryEncodingId = 0,
12342  .membersSize = 1,
12343  .members = ByteString_members },
12344 
12345 /* XmlElement */
12346 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 16},
12347  .typeIndex = UA_TYPES_XMLELEMENT,
12348 #ifdef UA_ENABLE_TYPENAMES
12349  .typeName = "XmlElement",
12350 #endif
12351  .memSize = sizeof(UA_XmlElement),
12352  .builtin = true,
12353  .fixedSize = false,
12354  .overlayable = false,
12355  .binaryEncodingId = 0,
12356  .membersSize = 1,
12357  .members = XmlElement_members },
12358 
12359 /* NodeId */
12360 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 17},
12361  .typeIndex = UA_TYPES_NODEID,
12362 #ifdef UA_ENABLE_TYPENAMES
12363  .typeName = "NodeId",
12364 #endif
12365  .memSize = sizeof(UA_NodeId),
12366  .builtin = true,
12367  .fixedSize = false,
12368  .overlayable = false,
12369  .binaryEncodingId = 0,
12370  .membersSize = 1,
12371  .members = NodeId_members },
12372 
12373 /* ExpandedNodeId */
12374 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 18},
12375  .typeIndex = UA_TYPES_EXPANDEDNODEID,
12376 #ifdef UA_ENABLE_TYPENAMES
12377  .typeName = "ExpandedNodeId",
12378 #endif
12379  .memSize = sizeof(UA_ExpandedNodeId),
12380  .builtin = true,
12381  .fixedSize = false,
12382  .overlayable = false,
12383  .binaryEncodingId = 0,
12384  .membersSize = 1,
12385  .members = ExpandedNodeId_members },
12386 
12387 /* StatusCode */
12388 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 19},
12389  .typeIndex = UA_TYPES_STATUSCODE,
12390 #ifdef UA_ENABLE_TYPENAMES
12391  .typeName = "StatusCode",
12392 #endif
12393  .memSize = sizeof(UA_StatusCode),
12394  .builtin = true,
12395  .fixedSize = true,
12396  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
12397  .binaryEncodingId = 0,
12398  .membersSize = 1,
12399  .members = StatusCode_members },
12400 
12401 /* QualifiedName */
12402 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 20},
12403  .typeIndex = UA_TYPES_QUALIFIEDNAME,
12404 #ifdef UA_ENABLE_TYPENAMES
12405  .typeName = "QualifiedName",
12406 #endif
12407  .memSize = sizeof(UA_QualifiedName),
12408  .builtin = true,
12409  .fixedSize = false,
12410  .overlayable = false,
12411  .binaryEncodingId = 0,
12412  .membersSize = 2,
12413  .members = QualifiedName_members },
12414 
12415 /* LocalizedText */
12416 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 21},
12417  .typeIndex = UA_TYPES_LOCALIZEDTEXT,
12418 #ifdef UA_ENABLE_TYPENAMES
12419  .typeName = "LocalizedText",
12420 #endif
12421  .memSize = sizeof(UA_LocalizedText),
12422  .builtin = true,
12423  .fixedSize = false,
12424  .overlayable = false,
12425  .binaryEncodingId = 0,
12426  .membersSize = 1,
12427  .members = LocalizedText_members },
12428 
12429 /* ExtensionObject */
12430 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 22},
12431  .typeIndex = UA_TYPES_EXTENSIONOBJECT,
12432 #ifdef UA_ENABLE_TYPENAMES
12433  .typeName = "ExtensionObject",
12434 #endif
12435  .memSize = sizeof(UA_ExtensionObject),
12436  .builtin = true,
12437  .fixedSize = false,
12438  .overlayable = false,
12439  .binaryEncodingId = 0,
12440  .membersSize = 1,
12441  .members = ExtensionObject_members },
12442 
12443 /* DataValue */
12444 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 23},
12445  .typeIndex = UA_TYPES_DATAVALUE,
12446 #ifdef UA_ENABLE_TYPENAMES
12447  .typeName = "DataValue",
12448 #endif
12449  .memSize = sizeof(UA_DataValue),
12450  .builtin = true,
12451  .fixedSize = false,
12452  .overlayable = false,
12453  .binaryEncodingId = 0,
12454  .membersSize = 1,
12455  .members = DataValue_members },
12456 
12457 /* Variant */
12458 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 24},
12459  .typeIndex = UA_TYPES_VARIANT,
12460 #ifdef UA_ENABLE_TYPENAMES
12461  .typeName = "Variant",
12462 #endif
12463  .memSize = sizeof(UA_Variant),
12464  .builtin = true,
12465  .fixedSize = false,
12466  .overlayable = false,
12467  .binaryEncodingId = 0,
12468  .membersSize = 1,
12469  .members = Variant_members },
12470 
12471 /* DiagnosticInfo */
12472 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 25},
12473  .typeIndex = UA_TYPES_DIAGNOSTICINFO,
12474 #ifdef UA_ENABLE_TYPENAMES
12475  .typeName = "DiagnosticInfo",
12476 #endif
12477  .memSize = sizeof(UA_DiagnosticInfo),
12478  .builtin = true,
12479  .fixedSize = false,
12480  .overlayable = false,
12481  .binaryEncodingId = 0,
12482  .membersSize = 1,
12483  .members = DiagnosticInfo_members },
12484 
12485 /* SignedSoftwareCertificate */
12486 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 344},
12488 #ifdef UA_ENABLE_TYPENAMES
12489  .typeName = "SignedSoftwareCertificate",
12490 #endif
12491  .memSize = sizeof(UA_SignedSoftwareCertificate),
12492  .builtin = false,
12493  .fixedSize = false,
12494  .overlayable = false,
12495  .binaryEncodingId = 346,
12496  .membersSize = 2,
12497  .members = SignedSoftwareCertificate_members },
12498 
12499 /* BrowsePathTarget */
12500 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 546},
12501  .typeIndex = UA_TYPES_BROWSEPATHTARGET,
12502 #ifdef UA_ENABLE_TYPENAMES
12503  .typeName = "BrowsePathTarget",
12504 #endif
12505  .memSize = sizeof(UA_BrowsePathTarget),
12506  .builtin = false,
12507  .fixedSize = false,
12508  .overlayable = false,
12509  .binaryEncodingId = 548,
12510  .membersSize = 2,
12511  .members = BrowsePathTarget_members },
12512 
12513 /* ViewAttributes */
12514 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 373},
12515  .typeIndex = UA_TYPES_VIEWATTRIBUTES,
12516 #ifdef UA_ENABLE_TYPENAMES
12517  .typeName = "ViewAttributes",
12518 #endif
12519  .memSize = sizeof(UA_ViewAttributes),
12520  .builtin = false,
12521  .fixedSize = false,
12522  .overlayable = false,
12523  .binaryEncodingId = 375,
12524  .membersSize = 7,
12525  .members = ViewAttributes_members },
12526 
12527 /* BrowseResultMask */
12528 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 6},
12529  .typeIndex = UA_TYPES_INT32,
12530 #ifdef UA_ENABLE_TYPENAMES
12531  .typeName = "BrowseResultMask",
12532 #endif
12533  .memSize = sizeof(UA_BrowseResultMask),
12534  .builtin = true,
12535  .fixedSize = true,
12536  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
12537  .binaryEncodingId = 0,
12538  .membersSize = 1,
12539  .members = BrowseResultMask_members },
12540 
12541 /* RequestHeader */
12542 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 389},
12543  .typeIndex = UA_TYPES_REQUESTHEADER,
12544 #ifdef UA_ENABLE_TYPENAMES
12545  .typeName = "RequestHeader",
12546 #endif
12547  .memSize = sizeof(UA_RequestHeader),
12548  .builtin = false,
12549  .fixedSize = false,
12550  .overlayable = false,
12551  .binaryEncodingId = 391,
12552  .membersSize = 7,
12553  .members = RequestHeader_members },
12554 
12555 /* MonitoredItemModifyResult */
12556 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 758},
12558 #ifdef UA_ENABLE_TYPENAMES
12559  .typeName = "MonitoredItemModifyResult",
12560 #endif
12561  .memSize = sizeof(UA_MonitoredItemModifyResult),
12562  .builtin = false,
12563  .fixedSize = false,
12564  .overlayable = false,
12565  .binaryEncodingId = 760,
12566  .membersSize = 4,
12567  .members = MonitoredItemModifyResult_members },
12568 
12569 /* CloseSecureChannelRequest */
12570 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 450},
12572 #ifdef UA_ENABLE_TYPENAMES
12573  .typeName = "CloseSecureChannelRequest",
12574 #endif
12575  .memSize = sizeof(UA_CloseSecureChannelRequest),
12576  .builtin = false,
12577  .fixedSize = false,
12578  .overlayable = false,
12579  .binaryEncodingId = 452,
12580  .membersSize = 1,
12581  .members = CloseSecureChannelRequest_members },
12582 
12583 /* AddNodesResult */
12584 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 483},
12585  .typeIndex = UA_TYPES_ADDNODESRESULT,
12586 #ifdef UA_ENABLE_TYPENAMES
12587  .typeName = "AddNodesResult",
12588 #endif
12589  .memSize = sizeof(UA_AddNodesResult),
12590  .builtin = false,
12591  .fixedSize = false,
12592  .overlayable = false,
12593  .binaryEncodingId = 485,
12594  .membersSize = 2,
12595  .members = AddNodesResult_members },
12596 
12597 /* VariableAttributes */
12598 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 355},
12599  .typeIndex = UA_TYPES_VARIABLEATTRIBUTES,
12600 #ifdef UA_ENABLE_TYPENAMES
12601  .typeName = "VariableAttributes",
12602 #endif
12603  .memSize = sizeof(UA_VariableAttributes),
12604  .builtin = false,
12605  .fixedSize = false,
12606  .overlayable = false,
12607  .binaryEncodingId = 357,
12608  .membersSize = 13,
12609  .members = VariableAttributes_members },
12610 
12611 /* NotificationMessage */
12612 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 803},
12613  .typeIndex = UA_TYPES_NOTIFICATIONMESSAGE,
12614 #ifdef UA_ENABLE_TYPENAMES
12615  .typeName = "NotificationMessage",
12616 #endif
12617  .memSize = sizeof(UA_NotificationMessage),
12618  .builtin = false,
12619  .fixedSize = false,
12620  .overlayable = false,
12621  .binaryEncodingId = 805,
12622  .membersSize = 3,
12623  .members = NotificationMessage_members },
12624 
12625 /* NodeAttributesMask */
12626 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 6},
12627  .typeIndex = UA_TYPES_INT32,
12628 #ifdef UA_ENABLE_TYPENAMES
12629  .typeName = "NodeAttributesMask",
12630 #endif
12631  .memSize = sizeof(UA_NodeAttributesMask),
12632  .builtin = true,
12633  .fixedSize = true,
12634  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
12635  .binaryEncodingId = 0,
12636  .membersSize = 1,
12637  .members = NodeAttributesMask_members },
12638 
12639 /* MonitoringMode */
12640 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 6},
12641  .typeIndex = UA_TYPES_INT32,
12642 #ifdef UA_ENABLE_TYPENAMES
12643  .typeName = "MonitoringMode",
12644 #endif
12645  .memSize = sizeof(UA_MonitoringMode),
12646  .builtin = true,
12647  .fixedSize = true,
12648  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
12649  .binaryEncodingId = 0,
12650  .membersSize = 1,
12651  .members = MonitoringMode_members },
12652 
12653 /* CallMethodResult */
12654 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 707},
12655  .typeIndex = UA_TYPES_CALLMETHODRESULT,
12656 #ifdef UA_ENABLE_TYPENAMES
12657  .typeName = "CallMethodResult",
12658 #endif
12659  .memSize = sizeof(UA_CallMethodResult),
12660  .builtin = false,
12661  .fixedSize = false,
12662  .overlayable = false,
12663  .binaryEncodingId = 709,
12664  .membersSize = 4,
12665  .members = CallMethodResult_members },
12666 
12667 /* ParsingResult */
12668 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 610},
12669  .typeIndex = UA_TYPES_PARSINGRESULT,
12670 #ifdef UA_ENABLE_TYPENAMES
12671  .typeName = "ParsingResult",
12672 #endif
12673  .memSize = sizeof(UA_ParsingResult),
12674  .builtin = false,
12675  .fixedSize = false,
12676  .overlayable = false,
12677  .binaryEncodingId = 612,
12678  .membersSize = 3,
12679  .members = ParsingResult_members },
12680 
12681 /* RelativePathElement */
12682 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 537},
12683  .typeIndex = UA_TYPES_RELATIVEPATHELEMENT,
12684 #ifdef UA_ENABLE_TYPENAMES
12685  .typeName = "RelativePathElement",
12686 #endif
12687  .memSize = sizeof(UA_RelativePathElement),
12688  .builtin = false,
12689  .fixedSize = false,
12690  .overlayable = false,
12691  .binaryEncodingId = 539,
12692  .membersSize = 4,
12693  .members = RelativePathElement_members },
12694 
12695 /* BrowseDirection */
12696 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 6},
12697  .typeIndex = UA_TYPES_INT32,
12698 #ifdef UA_ENABLE_TYPENAMES
12699  .typeName = "BrowseDirection",
12700 #endif
12701  .memSize = sizeof(UA_BrowseDirection),
12702  .builtin = true,
12703  .fixedSize = true,
12704  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
12705  .binaryEncodingId = 0,
12706  .membersSize = 1,
12707  .members = BrowseDirection_members },
12708 
12709 /* CallMethodRequest */
12710 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 704},
12711  .typeIndex = UA_TYPES_CALLMETHODREQUEST,
12712 #ifdef UA_ENABLE_TYPENAMES
12713  .typeName = "CallMethodRequest",
12714 #endif
12715  .memSize = sizeof(UA_CallMethodRequest),
12716  .builtin = false,
12717  .fixedSize = false,
12718  .overlayable = false,
12719  .binaryEncodingId = 706,
12720  .membersSize = 3,
12721  .members = CallMethodRequest_members },
12722 
12723 /* UnregisterNodesRequest */
12724 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 564},
12725  .typeIndex = UA_TYPES_UNREGISTERNODESREQUEST,
12726 #ifdef UA_ENABLE_TYPENAMES
12727  .typeName = "UnregisterNodesRequest",
12728 #endif
12729  .memSize = sizeof(UA_UnregisterNodesRequest),
12730  .builtin = false,
12731  .fixedSize = false,
12732  .overlayable = false,
12733  .binaryEncodingId = 566,
12734  .membersSize = 2,
12735  .members = UnregisterNodesRequest_members },
12736 
12737 /* ContentFilterElementResult */
12738 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 604},
12740 #ifdef UA_ENABLE_TYPENAMES
12741  .typeName = "ContentFilterElementResult",
12742 #endif
12743  .memSize = sizeof(UA_ContentFilterElementResult),
12744  .builtin = false,
12745  .fixedSize = false,
12746  .overlayable = false,
12747  .binaryEncodingId = 606,
12748  .membersSize = 3,
12749  .members = ContentFilterElementResult_members },
12750 
12751 /* QueryDataSet */
12752 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 577},
12753  .typeIndex = UA_TYPES_QUERYDATASET,
12754 #ifdef UA_ENABLE_TYPENAMES
12755  .typeName = "QueryDataSet",
12756 #endif
12757  .memSize = sizeof(UA_QueryDataSet),
12758  .builtin = false,
12759  .fixedSize = false,
12760  .overlayable = false,
12761  .binaryEncodingId = 579,
12762  .membersSize = 3,
12763  .members = QueryDataSet_members },
12764 
12765 /* AnonymousIdentityToken */
12766 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 319},
12767  .typeIndex = UA_TYPES_ANONYMOUSIDENTITYTOKEN,
12768 #ifdef UA_ENABLE_TYPENAMES
12769  .typeName = "AnonymousIdentityToken",
12770 #endif
12771  .memSize = sizeof(UA_AnonymousIdentityToken),
12772  .builtin = false,
12773  .fixedSize = false,
12774  .overlayable = false,
12775  .binaryEncodingId = 321,
12776  .membersSize = 1,
12777  .members = AnonymousIdentityToken_members },
12778 
12779 /* SetPublishingModeRequest */
12780 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 797},
12781  .typeIndex = UA_TYPES_SETPUBLISHINGMODEREQUEST,
12782 #ifdef UA_ENABLE_TYPENAMES
12783  .typeName = "SetPublishingModeRequest",
12784 #endif
12785  .memSize = sizeof(UA_SetPublishingModeRequest),
12786  .builtin = false,
12787  .fixedSize = false,
12788  .overlayable = false,
12789  .binaryEncodingId = 799,
12790  .membersSize = 3,
12791  .members = SetPublishingModeRequest_members },
12792 
12793 /* TimestampsToReturn */
12794 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 6},
12795  .typeIndex = UA_TYPES_INT32,
12796 #ifdef UA_ENABLE_TYPENAMES
12797  .typeName = "TimestampsToReturn",
12798 #endif
12799  .memSize = sizeof(UA_TimestampsToReturn),
12800  .builtin = true,
12801  .fixedSize = true,
12802  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
12803  .binaryEncodingId = 0,
12804  .membersSize = 1,
12805  .members = TimestampsToReturn_members },
12806 
12807 /* CallRequest */
12808 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 710},
12809  .typeIndex = UA_TYPES_CALLREQUEST,
12810 #ifdef UA_ENABLE_TYPENAMES
12811  .typeName = "CallRequest",
12812 #endif
12813  .memSize = sizeof(UA_CallRequest),
12814  .builtin = false,
12815  .fixedSize = false,
12816  .overlayable = false,
12817  .binaryEncodingId = 712,
12818  .membersSize = 2,
12819  .members = CallRequest_members },
12820 
12821 /* MethodAttributes */
12822 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 358},
12823  .typeIndex = UA_TYPES_METHODATTRIBUTES,
12824 #ifdef UA_ENABLE_TYPENAMES
12825  .typeName = "MethodAttributes",
12826 #endif
12827  .memSize = sizeof(UA_MethodAttributes),
12828  .builtin = false,
12829  .fixedSize = false,
12830  .overlayable = false,
12831  .binaryEncodingId = 360,
12832  .membersSize = 7,
12833  .members = MethodAttributes_members },
12834 
12835 /* DeleteReferencesItem */
12836 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 385},
12837  .typeIndex = UA_TYPES_DELETEREFERENCESITEM,
12838 #ifdef UA_ENABLE_TYPENAMES
12839  .typeName = "DeleteReferencesItem",
12840 #endif
12841  .memSize = sizeof(UA_DeleteReferencesItem),
12842  .builtin = false,
12843  .fixedSize = false,
12844  .overlayable = false,
12845  .binaryEncodingId = 387,
12846  .membersSize = 5,
12847  .members = DeleteReferencesItem_members },
12848 
12849 /* WriteValue */
12850 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 668},
12851  .typeIndex = UA_TYPES_WRITEVALUE,
12852 #ifdef UA_ENABLE_TYPENAMES
12853  .typeName = "WriteValue",
12854 #endif
12855  .memSize = sizeof(UA_WriteValue),
12856  .builtin = false,
12857  .fixedSize = false,
12858  .overlayable = false,
12859  .binaryEncodingId = 670,
12860  .membersSize = 4,
12861  .members = WriteValue_members },
12862 
12863 /* MonitoredItemCreateResult */
12864 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 746},
12866 #ifdef UA_ENABLE_TYPENAMES
12867  .typeName = "MonitoredItemCreateResult",
12868 #endif
12869  .memSize = sizeof(UA_MonitoredItemCreateResult),
12870  .builtin = false,
12871  .fixedSize = false,
12872  .overlayable = false,
12873  .binaryEncodingId = 748,
12874  .membersSize = 5,
12875  .members = MonitoredItemCreateResult_members },
12876 
12877 /* MessageSecurityMode */
12878 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 6},
12879  .typeIndex = UA_TYPES_INT32,
12880 #ifdef UA_ENABLE_TYPENAMES
12881  .typeName = "MessageSecurityMode",
12882 #endif
12883  .memSize = sizeof(UA_MessageSecurityMode),
12884  .builtin = true,
12885  .fixedSize = true,
12886  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
12887  .binaryEncodingId = 0,
12888  .membersSize = 1,
12889  .members = MessageSecurityMode_members },
12890 
12891 /* MonitoringParameters */
12892 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 740},
12893  .typeIndex = UA_TYPES_MONITORINGPARAMETERS,
12894 #ifdef UA_ENABLE_TYPENAMES
12895  .typeName = "MonitoringParameters",
12896 #endif
12897  .memSize = sizeof(UA_MonitoringParameters),
12898  .builtin = false,
12899  .fixedSize = false,
12900  .overlayable = false,
12901  .binaryEncodingId = 742,
12902  .membersSize = 5,
12903  .members = MonitoringParameters_members },
12904 
12905 /* SignatureData */
12906 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 456},
12907  .typeIndex = UA_TYPES_SIGNATUREDATA,
12908 #ifdef UA_ENABLE_TYPENAMES
12909  .typeName = "SignatureData",
12910 #endif
12911  .memSize = sizeof(UA_SignatureData),
12912  .builtin = false,
12913  .fixedSize = false,
12914  .overlayable = false,
12915  .binaryEncodingId = 458,
12916  .membersSize = 2,
12917  .members = SignatureData_members },
12918 
12919 /* ReferenceNode */
12920 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 285},
12921  .typeIndex = UA_TYPES_REFERENCENODE,
12922 #ifdef UA_ENABLE_TYPENAMES
12923  .typeName = "ReferenceNode",
12924 #endif
12925  .memSize = sizeof(UA_ReferenceNode),
12926  .builtin = false,
12927  .fixedSize = false,
12928  .overlayable = false,
12929  .binaryEncodingId = 287,
12930  .membersSize = 3,
12931  .members = ReferenceNode_members },
12932 
12933 /* Argument */
12934 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 296},
12935  .typeIndex = UA_TYPES_ARGUMENT,
12936 #ifdef UA_ENABLE_TYPENAMES
12937  .typeName = "Argument",
12938 #endif
12939  .memSize = sizeof(UA_Argument),
12940  .builtin = false,
12941  .fixedSize = false,
12942  .overlayable = false,
12943  .binaryEncodingId = 298,
12944  .membersSize = 5,
12945  .members = Argument_members },
12946 
12947 /* UserIdentityToken */
12948 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 316},
12949  .typeIndex = UA_TYPES_USERIDENTITYTOKEN,
12950 #ifdef UA_ENABLE_TYPENAMES
12951  .typeName = "UserIdentityToken",
12952 #endif
12953  .memSize = sizeof(UA_UserIdentityToken),
12954  .builtin = false,
12955  .fixedSize = false,
12956  .overlayable = false,
12957  .binaryEncodingId = 318,
12958  .membersSize = 1,
12959  .members = UserIdentityToken_members },
12960 
12961 /* ObjectTypeAttributes */
12962 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 361},
12963  .typeIndex = UA_TYPES_OBJECTTYPEATTRIBUTES,
12964 #ifdef UA_ENABLE_TYPENAMES
12965  .typeName = "ObjectTypeAttributes",
12966 #endif
12967  .memSize = sizeof(UA_ObjectTypeAttributes),
12968  .builtin = false,
12969  .fixedSize = false,
12970  .overlayable = false,
12971  .binaryEncodingId = 363,
12972  .membersSize = 6,
12973  .members = ObjectTypeAttributes_members },
12974 
12975 /* DeadbandType */
12976 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 6},
12977  .typeIndex = UA_TYPES_INT32,
12978 #ifdef UA_ENABLE_TYPENAMES
12979  .typeName = "DeadbandType",
12980 #endif
12981  .memSize = sizeof(UA_DeadbandType),
12982  .builtin = true,
12983  .fixedSize = true,
12984  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
12985  .binaryEncodingId = 0,
12986  .membersSize = 1,
12987  .members = DeadbandType_members },
12988 
12989 /* SecurityTokenRequestType */
12990 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 6},
12991  .typeIndex = UA_TYPES_INT32,
12992 #ifdef UA_ENABLE_TYPENAMES
12993  .typeName = "SecurityTokenRequestType",
12994 #endif
12995  .memSize = sizeof(UA_SecurityTokenRequestType),
12996  .builtin = true,
12997  .fixedSize = true,
12998  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
12999  .binaryEncodingId = 0,
13000  .membersSize = 1,
13001  .members = SecurityTokenRequestType_members },
13002 
13003 /* DataChangeTrigger */
13004 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 6},
13005  .typeIndex = UA_TYPES_INT32,
13006 #ifdef UA_ENABLE_TYPENAMES
13007  .typeName = "DataChangeTrigger",
13008 #endif
13009  .memSize = sizeof(UA_DataChangeTrigger),
13010  .builtin = true,
13011  .fixedSize = true,
13012  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
13013  .binaryEncodingId = 0,
13014  .membersSize = 1,
13015  .members = DataChangeTrigger_members },
13016 
13017 /* BuildInfo */
13018 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 338},
13019  .typeIndex = UA_TYPES_BUILDINFO,
13020 #ifdef UA_ENABLE_TYPENAMES
13021  .typeName = "BuildInfo",
13022 #endif
13023  .memSize = sizeof(UA_BuildInfo),
13024  .builtin = false,
13025  .fixedSize = false,
13026  .overlayable = false,
13027  .binaryEncodingId = 340,
13028  .membersSize = 6,
13029  .members = BuildInfo_members },
13030 
13031 /* NodeClass */
13032 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 6},
13033  .typeIndex = UA_TYPES_INT32,
13034 #ifdef UA_ENABLE_TYPENAMES
13035  .typeName = "NodeClass",
13036 #endif
13037  .memSize = sizeof(UA_NodeClass),
13038  .builtin = true,
13039  .fixedSize = true,
13040  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
13041  .binaryEncodingId = 0,
13042  .membersSize = 1,
13043  .members = NodeClass_members },
13044 
13045 /* ChannelSecurityToken */
13046 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 441},
13047  .typeIndex = UA_TYPES_CHANNELSECURITYTOKEN,
13048 #ifdef UA_ENABLE_TYPENAMES
13049  .typeName = "ChannelSecurityToken",
13050 #endif
13051  .memSize = sizeof(UA_ChannelSecurityToken),
13052  .builtin = false,
13053  .fixedSize = true,
13054  .overlayable = true && UA_BINARY_OVERLAYABLE_INTEGER && UA_BINARY_OVERLAYABLE_INTEGER && offsetof(UA_ChannelSecurityToken, tokenId) == (offsetof(UA_ChannelSecurityToken, channelId) + sizeof(UA_UInt32)) && UA_BINARY_OVERLAYABLE_INTEGER && offsetof(UA_ChannelSecurityToken, createdAt) == (offsetof(UA_ChannelSecurityToken, tokenId) + sizeof(UA_UInt32)) && UA_BINARY_OVERLAYABLE_INTEGER && offsetof(UA_ChannelSecurityToken, revisedLifetime) == (offsetof(UA_ChannelSecurityToken, createdAt) + sizeof(UA_DateTime)),
13055  .binaryEncodingId = 443,
13056  .membersSize = 4,
13057  .members = ChannelSecurityToken_members },
13058 
13059 /* MonitoredItemNotification */
13060 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 806},
13062 #ifdef UA_ENABLE_TYPENAMES
13063  .typeName = "MonitoredItemNotification",
13064 #endif
13065  .memSize = sizeof(UA_MonitoredItemNotification),
13066  .builtin = false,
13067  .fixedSize = false,
13068  .overlayable = false,
13069  .binaryEncodingId = 808,
13070  .membersSize = 2,
13071  .members = MonitoredItemNotification_members },
13072 
13073 /* DeleteNodesItem */
13074 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 382},
13075  .typeIndex = UA_TYPES_DELETENODESITEM,
13076 #ifdef UA_ENABLE_TYPENAMES
13077  .typeName = "DeleteNodesItem",
13078 #endif
13079  .memSize = sizeof(UA_DeleteNodesItem),
13080  .builtin = false,
13081  .fixedSize = false,
13082  .overlayable = false,
13083  .binaryEncodingId = 384,
13084  .membersSize = 2,
13085  .members = DeleteNodesItem_members },
13086 
13087 /* SubscriptionAcknowledgement */
13088 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 821},
13090 #ifdef UA_ENABLE_TYPENAMES
13091  .typeName = "SubscriptionAcknowledgement",
13092 #endif
13093  .memSize = sizeof(UA_SubscriptionAcknowledgement),
13094  .builtin = false,
13095  .fixedSize = true,
13096  .overlayable = true && UA_BINARY_OVERLAYABLE_INTEGER && UA_BINARY_OVERLAYABLE_INTEGER && offsetof(UA_SubscriptionAcknowledgement, sequenceNumber) == (offsetof(UA_SubscriptionAcknowledgement, subscriptionId) + sizeof(UA_UInt32)),
13097  .binaryEncodingId = 823,
13098  .membersSize = 2,
13099  .members = SubscriptionAcknowledgement_members },
13100 
13101 /* ReadValueId */
13102 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 626},
13103  .typeIndex = UA_TYPES_READVALUEID,
13104 #ifdef UA_ENABLE_TYPENAMES
13105  .typeName = "ReadValueId",
13106 #endif
13107  .memSize = sizeof(UA_ReadValueId),
13108  .builtin = false,
13109  .fixedSize = false,
13110  .overlayable = false,
13111  .binaryEncodingId = 628,
13112  .membersSize = 4,
13113  .members = ReadValueId_members },
13114 
13115 /* DataTypeAttributes */
13116 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 370},
13117  .typeIndex = UA_TYPES_DATATYPEATTRIBUTES,
13118 #ifdef UA_ENABLE_TYPENAMES
13119  .typeName = "DataTypeAttributes",
13120 #endif
13121  .memSize = sizeof(UA_DataTypeAttributes),
13122  .builtin = false,
13123  .fixedSize = false,
13124  .overlayable = false,
13125  .binaryEncodingId = 372,
13126  .membersSize = 6,
13127  .members = DataTypeAttributes_members },
13128 
13129 /* ResponseHeader */
13130 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 392},
13131  .typeIndex = UA_TYPES_RESPONSEHEADER,
13132 #ifdef UA_ENABLE_TYPENAMES
13133  .typeName = "ResponseHeader",
13134 #endif
13135  .memSize = sizeof(UA_ResponseHeader),
13136  .builtin = false,
13137  .fixedSize = false,
13138  .overlayable = false,
13139  .binaryEncodingId = 394,
13140  .membersSize = 6,
13141  .members = ResponseHeader_members },
13142 
13143 /* DeleteSubscriptionsRequest */
13144 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 845},
13146 #ifdef UA_ENABLE_TYPENAMES
13147  .typeName = "DeleteSubscriptionsRequest",
13148 #endif
13149  .memSize = sizeof(UA_DeleteSubscriptionsRequest),
13150  .builtin = false,
13151  .fixedSize = false,
13152  .overlayable = false,
13153  .binaryEncodingId = 847,
13154  .membersSize = 2,
13155  .members = DeleteSubscriptionsRequest_members },
13156 
13157 /* ViewDescription */
13158 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 511},
13159  .typeIndex = UA_TYPES_VIEWDESCRIPTION,
13160 #ifdef UA_ENABLE_TYPENAMES
13161  .typeName = "ViewDescription",
13162 #endif
13163  .memSize = sizeof(UA_ViewDescription),
13164  .builtin = false,
13165  .fixedSize = false,
13166  .overlayable = false,
13167  .binaryEncodingId = 513,
13168  .membersSize = 3,
13169  .members = ViewDescription_members },
13170 
13171 /* DeleteMonitoredItemsResponse */
13172 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 782},
13174 #ifdef UA_ENABLE_TYPENAMES
13175  .typeName = "DeleteMonitoredItemsResponse",
13176 #endif
13177  .memSize = sizeof(UA_DeleteMonitoredItemsResponse),
13178  .builtin = false,
13179  .fixedSize = false,
13180  .overlayable = false,
13181  .binaryEncodingId = 784,
13182  .membersSize = 3,
13183  .members = DeleteMonitoredItemsResponse_members },
13184 
13185 /* NodeAttributes */
13186 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 349},
13187  .typeIndex = UA_TYPES_NODEATTRIBUTES,
13188 #ifdef UA_ENABLE_TYPENAMES
13189  .typeName = "NodeAttributes",
13190 #endif
13191  .memSize = sizeof(UA_NodeAttributes),
13192  .builtin = false,
13193  .fixedSize = false,
13194  .overlayable = false,
13195  .binaryEncodingId = 351,
13196  .membersSize = 5,
13197  .members = NodeAttributes_members },
13198 
13199 /* RegisterNodesRequest */
13200 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 558},
13201  .typeIndex = UA_TYPES_REGISTERNODESREQUEST,
13202 #ifdef UA_ENABLE_TYPENAMES
13203  .typeName = "RegisterNodesRequest",
13204 #endif
13205  .memSize = sizeof(UA_RegisterNodesRequest),
13206  .builtin = false,
13207  .fixedSize = false,
13208  .overlayable = false,
13209  .binaryEncodingId = 560,
13210  .membersSize = 2,
13211  .members = RegisterNodesRequest_members },
13212 
13213 /* DeleteNodesRequest */
13214 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 498},
13215  .typeIndex = UA_TYPES_DELETENODESREQUEST,
13216 #ifdef UA_ENABLE_TYPENAMES
13217  .typeName = "DeleteNodesRequest",
13218 #endif
13219  .memSize = sizeof(UA_DeleteNodesRequest),
13220  .builtin = false,
13221  .fixedSize = false,
13222  .overlayable = false,
13223  .binaryEncodingId = 500,
13224  .membersSize = 2,
13225  .members = DeleteNodesRequest_members },
13226 
13227 /* PublishResponse */
13228 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 827},
13229  .typeIndex = UA_TYPES_PUBLISHRESPONSE,
13230 #ifdef UA_ENABLE_TYPENAMES
13231  .typeName = "PublishResponse",
13232 #endif
13233  .memSize = sizeof(UA_PublishResponse),
13234  .builtin = false,
13235  .fixedSize = false,
13236  .overlayable = false,
13237  .binaryEncodingId = 829,
13238  .membersSize = 7,
13239  .members = PublishResponse_members },
13240 
13241 /* MonitoredItemModifyRequest */
13242 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 755},
13244 #ifdef UA_ENABLE_TYPENAMES
13245  .typeName = "MonitoredItemModifyRequest",
13246 #endif
13247  .memSize = sizeof(UA_MonitoredItemModifyRequest),
13248  .builtin = false,
13249  .fixedSize = false,
13250  .overlayable = false,
13251  .binaryEncodingId = 757,
13252  .membersSize = 2,
13253  .members = MonitoredItemModifyRequest_members },
13254 
13255 /* UserNameIdentityToken */
13256 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 322},
13257  .typeIndex = UA_TYPES_USERNAMEIDENTITYTOKEN,
13258 #ifdef UA_ENABLE_TYPENAMES
13259  .typeName = "UserNameIdentityToken",
13260 #endif
13261  .memSize = sizeof(UA_UserNameIdentityToken),
13262  .builtin = false,
13263  .fixedSize = false,
13264  .overlayable = false,
13265  .binaryEncodingId = 324,
13266  .membersSize = 4,
13267  .members = UserNameIdentityToken_members },
13268 
13269 /* IdType */
13270 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 6},
13271  .typeIndex = UA_TYPES_INT32,
13272 #ifdef UA_ENABLE_TYPENAMES
13273  .typeName = "IdType",
13274 #endif
13275  .memSize = sizeof(UA_IdType),
13276  .builtin = true,
13277  .fixedSize = true,
13278  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
13279  .binaryEncodingId = 0,
13280  .membersSize = 1,
13281  .members = IdType_members },
13282 
13283 /* UserTokenType */
13284 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 6},
13285  .typeIndex = UA_TYPES_INT32,
13286 #ifdef UA_ENABLE_TYPENAMES
13287  .typeName = "UserTokenType",
13288 #endif
13289  .memSize = sizeof(UA_UserTokenType),
13290  .builtin = true,
13291  .fixedSize = true,
13292  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
13293  .binaryEncodingId = 0,
13294  .membersSize = 1,
13295  .members = UserTokenType_members },
13296 
13297 /* ActivateSessionRequest */
13298 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 465},
13299  .typeIndex = UA_TYPES_ACTIVATESESSIONREQUEST,
13300 #ifdef UA_ENABLE_TYPENAMES
13301  .typeName = "ActivateSessionRequest",
13302 #endif
13303  .memSize = sizeof(UA_ActivateSessionRequest),
13304  .builtin = false,
13305  .fixedSize = false,
13306  .overlayable = false,
13307  .binaryEncodingId = 467,
13308  .membersSize = 6,
13309  .members = ActivateSessionRequest_members },
13310 
13311 /* OpenSecureChannelResponse */
13312 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 447},
13314 #ifdef UA_ENABLE_TYPENAMES
13315  .typeName = "OpenSecureChannelResponse",
13316 #endif
13317  .memSize = sizeof(UA_OpenSecureChannelResponse),
13318  .builtin = false,
13319  .fixedSize = false,
13320  .overlayable = false,
13321  .binaryEncodingId = 449,
13322  .membersSize = 4,
13323  .members = OpenSecureChannelResponse_members },
13324 
13325 /* ApplicationType */
13326 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 6},
13327  .typeIndex = UA_TYPES_INT32,
13328 #ifdef UA_ENABLE_TYPENAMES
13329  .typeName = "ApplicationType",
13330 #endif
13331  .memSize = sizeof(UA_ApplicationType),
13332  .builtin = true,
13333  .fixedSize = true,
13334  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
13335  .binaryEncodingId = 0,
13336  .membersSize = 1,
13337  .members = ApplicationType_members },
13338 
13339 /* ServerState */
13340 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 6},
13341  .typeIndex = UA_TYPES_INT32,
13342 #ifdef UA_ENABLE_TYPENAMES
13343  .typeName = "ServerState",
13344 #endif
13345  .memSize = sizeof(UA_ServerState),
13346  .builtin = true,
13347  .fixedSize = true,
13348  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
13349  .binaryEncodingId = 0,
13350  .membersSize = 1,
13351  .members = ServerState_members },
13352 
13353 /* QueryNextResponse */
13354 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 622},
13355  .typeIndex = UA_TYPES_QUERYNEXTRESPONSE,
13356 #ifdef UA_ENABLE_TYPENAMES
13357  .typeName = "QueryNextResponse",
13358 #endif
13359  .memSize = sizeof(UA_QueryNextResponse),
13360  .builtin = false,
13361  .fixedSize = false,
13362  .overlayable = false,
13363  .binaryEncodingId = 624,
13364  .membersSize = 3,
13365  .members = QueryNextResponse_members },
13366 
13367 /* ActivateSessionResponse */
13368 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 468},
13369  .typeIndex = UA_TYPES_ACTIVATESESSIONRESPONSE,
13370 #ifdef UA_ENABLE_TYPENAMES
13371  .typeName = "ActivateSessionResponse",
13372 #endif
13373  .memSize = sizeof(UA_ActivateSessionResponse),
13374  .builtin = false,
13375  .fixedSize = false,
13376  .overlayable = false,
13377  .binaryEncodingId = 470,
13378  .membersSize = 4,
13379  .members = ActivateSessionResponse_members },
13380 
13381 /* FilterOperator */
13382 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 6},
13383  .typeIndex = UA_TYPES_INT32,
13384 #ifdef UA_ENABLE_TYPENAMES
13385  .typeName = "FilterOperator",
13386 #endif
13387  .memSize = sizeof(UA_FilterOperator),
13388  .builtin = true,
13389  .fixedSize = true,
13390  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
13391  .binaryEncodingId = 0,
13392  .membersSize = 1,
13393  .members = FilterOperator_members },
13394 
13395 /* QueryNextRequest */
13396 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 619},
13397  .typeIndex = UA_TYPES_QUERYNEXTREQUEST,
13398 #ifdef UA_ENABLE_TYPENAMES
13399  .typeName = "QueryNextRequest",
13400 #endif
13401  .memSize = sizeof(UA_QueryNextRequest),
13402  .builtin = false,
13403  .fixedSize = false,
13404  .overlayable = false,
13405  .binaryEncodingId = 621,
13406  .membersSize = 3,
13407  .members = QueryNextRequest_members },
13408 
13409 /* WriteResponse */
13410 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 674},
13411  .typeIndex = UA_TYPES_WRITERESPONSE,
13412 #ifdef UA_ENABLE_TYPENAMES
13413  .typeName = "WriteResponse",
13414 #endif
13415  .memSize = sizeof(UA_WriteResponse),
13416  .builtin = false,
13417  .fixedSize = false,
13418  .overlayable = false,
13419  .binaryEncodingId = 676,
13420  .membersSize = 3,
13421  .members = WriteResponse_members },
13422 
13423 /* BrowseNextRequest */
13424 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 531},
13425  .typeIndex = UA_TYPES_BROWSENEXTREQUEST,
13426 #ifdef UA_ENABLE_TYPENAMES
13427  .typeName = "BrowseNextRequest",
13428 #endif
13429  .memSize = sizeof(UA_BrowseNextRequest),
13430  .builtin = false,
13431  .fixedSize = false,
13432  .overlayable = false,
13433  .binaryEncodingId = 533,
13434  .membersSize = 3,
13435  .members = BrowseNextRequest_members },
13436 
13437 /* CreateSubscriptionRequest */
13438 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 785},
13440 #ifdef UA_ENABLE_TYPENAMES
13441  .typeName = "CreateSubscriptionRequest",
13442 #endif
13443  .memSize = sizeof(UA_CreateSubscriptionRequest),
13444  .builtin = false,
13445  .fixedSize = false,
13446  .overlayable = false,
13447  .binaryEncodingId = 787,
13448  .membersSize = 7,
13449  .members = CreateSubscriptionRequest_members },
13450 
13451 /* VariableTypeAttributes */
13452 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 364},
13453  .typeIndex = UA_TYPES_VARIABLETYPEATTRIBUTES,
13454 #ifdef UA_ENABLE_TYPENAMES
13455  .typeName = "VariableTypeAttributes",
13456 #endif
13457  .memSize = sizeof(UA_VariableTypeAttributes),
13458  .builtin = false,
13459  .fixedSize = false,
13460  .overlayable = false,
13461  .binaryEncodingId = 366,
13462  .membersSize = 10,
13463  .members = VariableTypeAttributes_members },
13464 
13465 /* BrowsePathResult */
13466 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 549},
13467  .typeIndex = UA_TYPES_BROWSEPATHRESULT,
13468 #ifdef UA_ENABLE_TYPENAMES
13469  .typeName = "BrowsePathResult",
13470 #endif
13471  .memSize = sizeof(UA_BrowsePathResult),
13472  .builtin = false,
13473  .fixedSize = false,
13474  .overlayable = false,
13475  .binaryEncodingId = 551,
13476  .membersSize = 2,
13477  .members = BrowsePathResult_members },
13478 
13479 /* ModifySubscriptionResponse */
13480 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 794},
13482 #ifdef UA_ENABLE_TYPENAMES
13483  .typeName = "ModifySubscriptionResponse",
13484 #endif
13485  .memSize = sizeof(UA_ModifySubscriptionResponse),
13486  .builtin = false,
13487  .fixedSize = false,
13488  .overlayable = false,
13489  .binaryEncodingId = 796,
13490  .membersSize = 4,
13491  .members = ModifySubscriptionResponse_members },
13492 
13493 /* OpenSecureChannelRequest */
13494 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 444},
13495  .typeIndex = UA_TYPES_OPENSECURECHANNELREQUEST,
13496 #ifdef UA_ENABLE_TYPENAMES
13497  .typeName = "OpenSecureChannelRequest",
13498 #endif
13499  .memSize = sizeof(UA_OpenSecureChannelRequest),
13500  .builtin = false,
13501  .fixedSize = false,
13502  .overlayable = false,
13503  .binaryEncodingId = 446,
13504  .membersSize = 6,
13505  .members = OpenSecureChannelRequest_members },
13506 
13507 /* RegisterNodesResponse */
13508 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 561},
13509  .typeIndex = UA_TYPES_REGISTERNODESRESPONSE,
13510 #ifdef UA_ENABLE_TYPENAMES
13511  .typeName = "RegisterNodesResponse",
13512 #endif
13513  .memSize = sizeof(UA_RegisterNodesResponse),
13514  .builtin = false,
13515  .fixedSize = false,
13516  .overlayable = false,
13517  .binaryEncodingId = 563,
13518  .membersSize = 2,
13519  .members = RegisterNodesResponse_members },
13520 
13521 /* CloseSessionRequest */
13522 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 471},
13523  .typeIndex = UA_TYPES_CLOSESESSIONREQUEST,
13524 #ifdef UA_ENABLE_TYPENAMES
13525  .typeName = "CloseSessionRequest",
13526 #endif
13527  .memSize = sizeof(UA_CloseSessionRequest),
13528  .builtin = false,
13529  .fixedSize = false,
13530  .overlayable = false,
13531  .binaryEncodingId = 473,
13532  .membersSize = 2,
13533  .members = CloseSessionRequest_members },
13534 
13535 /* ModifySubscriptionRequest */
13536 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 791},
13538 #ifdef UA_ENABLE_TYPENAMES
13539  .typeName = "ModifySubscriptionRequest",
13540 #endif
13541  .memSize = sizeof(UA_ModifySubscriptionRequest),
13542  .builtin = false,
13543  .fixedSize = false,
13544  .overlayable = false,
13545  .binaryEncodingId = 793,
13546  .membersSize = 7,
13547  .members = ModifySubscriptionRequest_members },
13548 
13549 /* UserTokenPolicy */
13550 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 304},
13551  .typeIndex = UA_TYPES_USERTOKENPOLICY,
13552 #ifdef UA_ENABLE_TYPENAMES
13553  .typeName = "UserTokenPolicy",
13554 #endif
13555  .memSize = sizeof(UA_UserTokenPolicy),
13556  .builtin = false,
13557  .fixedSize = false,
13558  .overlayable = false,
13559  .binaryEncodingId = 306,
13560  .membersSize = 5,
13561  .members = UserTokenPolicy_members },
13562 
13563 /* DeleteMonitoredItemsRequest */
13564 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 779},
13566 #ifdef UA_ENABLE_TYPENAMES
13567  .typeName = "DeleteMonitoredItemsRequest",
13568 #endif
13569  .memSize = sizeof(UA_DeleteMonitoredItemsRequest),
13570  .builtin = false,
13571  .fixedSize = false,
13572  .overlayable = false,
13573  .binaryEncodingId = 781,
13574  .membersSize = 3,
13575  .members = DeleteMonitoredItemsRequest_members },
13576 
13577 /* ReferenceTypeAttributes */
13578 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 367},
13579  .typeIndex = UA_TYPES_REFERENCETYPEATTRIBUTES,
13580 #ifdef UA_ENABLE_TYPENAMES
13581  .typeName = "ReferenceTypeAttributes",
13582 #endif
13583  .memSize = sizeof(UA_ReferenceTypeAttributes),
13584  .builtin = false,
13585  .fixedSize = false,
13586  .overlayable = false,
13587  .binaryEncodingId = 369,
13588  .membersSize = 8,
13589  .members = ReferenceTypeAttributes_members },
13590 
13591 /* SetMonitoringModeRequest */
13592 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 767},
13593  .typeIndex = UA_TYPES_SETMONITORINGMODEREQUEST,
13594 #ifdef UA_ENABLE_TYPENAMES
13595  .typeName = "SetMonitoringModeRequest",
13596 #endif
13597  .memSize = sizeof(UA_SetMonitoringModeRequest),
13598  .builtin = false,
13599  .fixedSize = false,
13600  .overlayable = false,
13601  .binaryEncodingId = 769,
13602  .membersSize = 4,
13603  .members = SetMonitoringModeRequest_members },
13604 
13605 /* UnregisterNodesResponse */
13606 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 567},
13607  .typeIndex = UA_TYPES_UNREGISTERNODESRESPONSE,
13608 #ifdef UA_ENABLE_TYPENAMES
13609  .typeName = "UnregisterNodesResponse",
13610 #endif
13611  .memSize = sizeof(UA_UnregisterNodesResponse),
13612  .builtin = false,
13613  .fixedSize = false,
13614  .overlayable = false,
13615  .binaryEncodingId = 569,
13616  .membersSize = 1,
13617  .members = UnregisterNodesResponse_members },
13618 
13619 /* WriteRequest */
13620 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 671},
13621  .typeIndex = UA_TYPES_WRITEREQUEST,
13622 #ifdef UA_ENABLE_TYPENAMES
13623  .typeName = "WriteRequest",
13624 #endif
13625  .memSize = sizeof(UA_WriteRequest),
13626  .builtin = false,
13627  .fixedSize = false,
13628  .overlayable = false,
13629  .binaryEncodingId = 673,
13630  .membersSize = 2,
13631  .members = WriteRequest_members },
13632 
13633 /* ObjectAttributes */
13634 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 352},
13635  .typeIndex = UA_TYPES_OBJECTATTRIBUTES,
13636 #ifdef UA_ENABLE_TYPENAMES
13637  .typeName = "ObjectAttributes",
13638 #endif
13639  .memSize = sizeof(UA_ObjectAttributes),
13640  .builtin = false,
13641  .fixedSize = false,
13642  .overlayable = false,
13643  .binaryEncodingId = 354,
13644  .membersSize = 6,
13645  .members = ObjectAttributes_members },
13646 
13647 /* BrowseDescription */
13648 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 514},
13649  .typeIndex = UA_TYPES_BROWSEDESCRIPTION,
13650 #ifdef UA_ENABLE_TYPENAMES
13651  .typeName = "BrowseDescription",
13652 #endif
13653  .memSize = sizeof(UA_BrowseDescription),
13654  .builtin = false,
13655  .fixedSize = false,
13656  .overlayable = false,
13657  .binaryEncodingId = 516,
13658  .membersSize = 6,
13659  .members = BrowseDescription_members },
13660 
13661 /* RepublishRequest */
13662 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 830},
13663  .typeIndex = UA_TYPES_REPUBLISHREQUEST,
13664 #ifdef UA_ENABLE_TYPENAMES
13665  .typeName = "RepublishRequest",
13666 #endif
13667  .memSize = sizeof(UA_RepublishRequest),
13668  .builtin = false,
13669  .fixedSize = false,
13670  .overlayable = false,
13671  .binaryEncodingId = 832,
13672  .membersSize = 3,
13673  .members = RepublishRequest_members },
13674 
13675 /* GetEndpointsRequest */
13676 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 426},
13677  .typeIndex = UA_TYPES_GETENDPOINTSREQUEST,
13678 #ifdef UA_ENABLE_TYPENAMES
13679  .typeName = "GetEndpointsRequest",
13680 #endif
13681  .memSize = sizeof(UA_GetEndpointsRequest),
13682  .builtin = false,
13683  .fixedSize = false,
13684  .overlayable = false,
13685  .binaryEncodingId = 428,
13686  .membersSize = 4,
13687  .members = GetEndpointsRequest_members },
13688 
13689 /* PublishRequest */
13690 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 824},
13691  .typeIndex = UA_TYPES_PUBLISHREQUEST,
13692 #ifdef UA_ENABLE_TYPENAMES
13693  .typeName = "PublishRequest",
13694 #endif
13695  .memSize = sizeof(UA_PublishRequest),
13696  .builtin = false,
13697  .fixedSize = false,
13698  .overlayable = false,
13699  .binaryEncodingId = 826,
13700  .membersSize = 2,
13701  .members = PublishRequest_members },
13702 
13703 /* AddNodesResponse */
13704 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 489},
13705  .typeIndex = UA_TYPES_ADDNODESRESPONSE,
13706 #ifdef UA_ENABLE_TYPENAMES
13707  .typeName = "AddNodesResponse",
13708 #endif
13709  .memSize = sizeof(UA_AddNodesResponse),
13710  .builtin = false,
13711  .fixedSize = false,
13712  .overlayable = false,
13713  .binaryEncodingId = 491,
13714  .membersSize = 3,
13715  .members = AddNodesResponse_members },
13716 
13717 /* DataChangeNotification */
13718 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 809},
13719  .typeIndex = UA_TYPES_DATACHANGENOTIFICATION,
13720 #ifdef UA_ENABLE_TYPENAMES
13721  .typeName = "DataChangeNotification",
13722 #endif
13723  .memSize = sizeof(UA_DataChangeNotification),
13724  .builtin = false,
13725  .fixedSize = false,
13726  .overlayable = false,
13727  .binaryEncodingId = 811,
13728  .membersSize = 2,
13729  .members = DataChangeNotification_members },
13730 
13731 /* CloseSecureChannelResponse */
13732 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 453},
13734 #ifdef UA_ENABLE_TYPENAMES
13735  .typeName = "CloseSecureChannelResponse",
13736 #endif
13737  .memSize = sizeof(UA_CloseSecureChannelResponse),
13738  .builtin = false,
13739  .fixedSize = false,
13740  .overlayable = false,
13741  .binaryEncodingId = 455,
13742  .membersSize = 1,
13743  .members = CloseSecureChannelResponse_members },
13744 
13745 /* ModifyMonitoredItemsRequest */
13746 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 761},
13748 #ifdef UA_ENABLE_TYPENAMES
13749  .typeName = "ModifyMonitoredItemsRequest",
13750 #endif
13751  .memSize = sizeof(UA_ModifyMonitoredItemsRequest),
13752  .builtin = false,
13753  .fixedSize = false,
13754  .overlayable = false,
13755  .binaryEncodingId = 763,
13756  .membersSize = 4,
13757  .members = ModifyMonitoredItemsRequest_members },
13758 
13759 /* SetMonitoringModeResponse */
13760 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 770},
13762 #ifdef UA_ENABLE_TYPENAMES
13763  .typeName = "SetMonitoringModeResponse",
13764 #endif
13765  .memSize = sizeof(UA_SetMonitoringModeResponse),
13766  .builtin = false,
13767  .fixedSize = false,
13768  .overlayable = false,
13769  .binaryEncodingId = 772,
13770  .membersSize = 3,
13771  .members = SetMonitoringModeResponse_members },
13772 
13773 /* FindServersRequest */
13774 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 420},
13775  .typeIndex = UA_TYPES_FINDSERVERSREQUEST,
13776 #ifdef UA_ENABLE_TYPENAMES
13777  .typeName = "FindServersRequest",
13778 #endif
13779  .memSize = sizeof(UA_FindServersRequest),
13780  .builtin = false,
13781  .fixedSize = false,
13782  .overlayable = false,
13783  .binaryEncodingId = 422,
13784  .membersSize = 4,
13785  .members = FindServersRequest_members },
13786 
13787 /* ReferenceDescription */
13788 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 518},
13789  .typeIndex = UA_TYPES_REFERENCEDESCRIPTION,
13790 #ifdef UA_ENABLE_TYPENAMES
13791  .typeName = "ReferenceDescription",
13792 #endif
13793  .memSize = sizeof(UA_ReferenceDescription),
13794  .builtin = false,
13795  .fixedSize = false,
13796  .overlayable = false,
13797  .binaryEncodingId = 520,
13798  .membersSize = 7,
13799  .members = ReferenceDescription_members },
13800 
13801 /* SetPublishingModeResponse */
13802 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 800},
13804 #ifdef UA_ENABLE_TYPENAMES
13805  .typeName = "SetPublishingModeResponse",
13806 #endif
13807  .memSize = sizeof(UA_SetPublishingModeResponse),
13808  .builtin = false,
13809  .fixedSize = false,
13810  .overlayable = false,
13811  .binaryEncodingId = 802,
13812  .membersSize = 3,
13813  .members = SetPublishingModeResponse_members },
13814 
13815 /* ContentFilterResult */
13816 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 607},
13817  .typeIndex = UA_TYPES_CONTENTFILTERRESULT,
13818 #ifdef UA_ENABLE_TYPENAMES
13819  .typeName = "ContentFilterResult",
13820 #endif
13821  .memSize = sizeof(UA_ContentFilterResult),
13822  .builtin = false,
13823  .fixedSize = false,
13824  .overlayable = false,
13825  .binaryEncodingId = 609,
13826  .membersSize = 2,
13827  .members = ContentFilterResult_members },
13828 
13829 /* AddReferencesItem */
13830 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 379},
13831  .typeIndex = UA_TYPES_ADDREFERENCESITEM,
13832 #ifdef UA_ENABLE_TYPENAMES
13833  .typeName = "AddReferencesItem",
13834 #endif
13835  .memSize = sizeof(UA_AddReferencesItem),
13836  .builtin = false,
13837  .fixedSize = false,
13838  .overlayable = false,
13839  .binaryEncodingId = 381,
13840  .membersSize = 6,
13841  .members = AddReferencesItem_members },
13842 
13843 /* CreateSubscriptionResponse */
13844 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 788},
13846 #ifdef UA_ENABLE_TYPENAMES
13847  .typeName = "CreateSubscriptionResponse",
13848 #endif
13849  .memSize = sizeof(UA_CreateSubscriptionResponse),
13850  .builtin = false,
13851  .fixedSize = false,
13852  .overlayable = false,
13853  .binaryEncodingId = 790,
13854  .membersSize = 5,
13855  .members = CreateSubscriptionResponse_members },
13856 
13857 /* DeleteSubscriptionsResponse */
13858 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 848},
13860 #ifdef UA_ENABLE_TYPENAMES
13861  .typeName = "DeleteSubscriptionsResponse",
13862 #endif
13863  .memSize = sizeof(UA_DeleteSubscriptionsResponse),
13864  .builtin = false,
13865  .fixedSize = false,
13866  .overlayable = false,
13867  .binaryEncodingId = 850,
13868  .membersSize = 3,
13869  .members = DeleteSubscriptionsResponse_members },
13870 
13871 /* RelativePath */
13872 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 540},
13873  .typeIndex = UA_TYPES_RELATIVEPATH,
13874 #ifdef UA_ENABLE_TYPENAMES
13875  .typeName = "RelativePath",
13876 #endif
13877  .memSize = sizeof(UA_RelativePath),
13878  .builtin = false,
13879  .fixedSize = false,
13880  .overlayable = false,
13881  .binaryEncodingId = 542,
13882  .membersSize = 1,
13883  .members = RelativePath_members },
13884 
13885 /* DeleteReferencesResponse */
13886 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 507},
13887  .typeIndex = UA_TYPES_DELETEREFERENCESRESPONSE,
13888 #ifdef UA_ENABLE_TYPENAMES
13889  .typeName = "DeleteReferencesResponse",
13890 #endif
13891  .memSize = sizeof(UA_DeleteReferencesResponse),
13892  .builtin = false,
13893  .fixedSize = false,
13894  .overlayable = false,
13895  .binaryEncodingId = 509,
13896  .membersSize = 3,
13897  .members = DeleteReferencesResponse_members },
13898 
13899 /* CreateMonitoredItemsResponse */
13900 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 752},
13902 #ifdef UA_ENABLE_TYPENAMES
13903  .typeName = "CreateMonitoredItemsResponse",
13904 #endif
13905  .memSize = sizeof(UA_CreateMonitoredItemsResponse),
13906  .builtin = false,
13907  .fixedSize = false,
13908  .overlayable = false,
13909  .binaryEncodingId = 754,
13910  .membersSize = 3,
13911  .members = CreateMonitoredItemsResponse_members },
13912 
13913 /* CallResponse */
13914 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 713},
13915  .typeIndex = UA_TYPES_CALLRESPONSE,
13916 #ifdef UA_ENABLE_TYPENAMES
13917  .typeName = "CallResponse",
13918 #endif
13919  .memSize = sizeof(UA_CallResponse),
13920  .builtin = false,
13921  .fixedSize = false,
13922  .overlayable = false,
13923  .binaryEncodingId = 715,
13924  .membersSize = 3,
13925  .members = CallResponse_members },
13926 
13927 /* DeleteNodesResponse */
13928 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 501},
13929  .typeIndex = UA_TYPES_DELETENODESRESPONSE,
13930 #ifdef UA_ENABLE_TYPENAMES
13931  .typeName = "DeleteNodesResponse",
13932 #endif
13933  .memSize = sizeof(UA_DeleteNodesResponse),
13934  .builtin = false,
13935  .fixedSize = false,
13936  .overlayable = false,
13937  .binaryEncodingId = 503,
13938  .membersSize = 3,
13939  .members = DeleteNodesResponse_members },
13940 
13941 /* RepublishResponse */
13942 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 833},
13943  .typeIndex = UA_TYPES_REPUBLISHRESPONSE,
13944 #ifdef UA_ENABLE_TYPENAMES
13945  .typeName = "RepublishResponse",
13946 #endif
13947  .memSize = sizeof(UA_RepublishResponse),
13948  .builtin = false,
13949  .fixedSize = false,
13950  .overlayable = false,
13951  .binaryEncodingId = 835,
13952  .membersSize = 2,
13953  .members = RepublishResponse_members },
13954 
13955 /* MonitoredItemCreateRequest */
13956 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 743},
13958 #ifdef UA_ENABLE_TYPENAMES
13959  .typeName = "MonitoredItemCreateRequest",
13960 #endif
13961  .memSize = sizeof(UA_MonitoredItemCreateRequest),
13962  .builtin = false,
13963  .fixedSize = false,
13964  .overlayable = false,
13965  .binaryEncodingId = 745,
13966  .membersSize = 3,
13967  .members = MonitoredItemCreateRequest_members },
13968 
13969 /* DeleteReferencesRequest */
13970 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 504},
13971  .typeIndex = UA_TYPES_DELETEREFERENCESREQUEST,
13972 #ifdef UA_ENABLE_TYPENAMES
13973  .typeName = "DeleteReferencesRequest",
13974 #endif
13975  .memSize = sizeof(UA_DeleteReferencesRequest),
13976  .builtin = false,
13977  .fixedSize = false,
13978  .overlayable = false,
13979  .binaryEncodingId = 506,
13980  .membersSize = 2,
13981  .members = DeleteReferencesRequest_members },
13982 
13983 /* ModifyMonitoredItemsResponse */
13984 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 764},
13986 #ifdef UA_ENABLE_TYPENAMES
13987  .typeName = "ModifyMonitoredItemsResponse",
13988 #endif
13989  .memSize = sizeof(UA_ModifyMonitoredItemsResponse),
13990  .builtin = false,
13991  .fixedSize = false,
13992  .overlayable = false,
13993  .binaryEncodingId = 766,
13994  .membersSize = 3,
13995  .members = ModifyMonitoredItemsResponse_members },
13996 
13997 /* ReadResponse */
13998 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 632},
13999  .typeIndex = UA_TYPES_READRESPONSE,
14000 #ifdef UA_ENABLE_TYPENAMES
14001  .typeName = "ReadResponse",
14002 #endif
14003  .memSize = sizeof(UA_ReadResponse),
14004  .builtin = false,
14005  .fixedSize = false,
14006  .overlayable = false,
14007  .binaryEncodingId = 634,
14008  .membersSize = 3,
14009  .members = ReadResponse_members },
14010 
14011 /* AddReferencesRequest */
14012 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 492},
14013  .typeIndex = UA_TYPES_ADDREFERENCESREQUEST,
14014 #ifdef UA_ENABLE_TYPENAMES
14015  .typeName = "AddReferencesRequest",
14016 #endif
14017  .memSize = sizeof(UA_AddReferencesRequest),
14018  .builtin = false,
14019  .fixedSize = false,
14020  .overlayable = false,
14021  .binaryEncodingId = 494,
14022  .membersSize = 2,
14023  .members = AddReferencesRequest_members },
14024 
14025 /* ReadRequest */
14026 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 629},
14027  .typeIndex = UA_TYPES_READREQUEST,
14028 #ifdef UA_ENABLE_TYPENAMES
14029  .typeName = "ReadRequest",
14030 #endif
14031  .memSize = sizeof(UA_ReadRequest),
14032  .builtin = false,
14033  .fixedSize = false,
14034  .overlayable = false,
14035  .binaryEncodingId = 631,
14036  .membersSize = 4,
14037  .members = ReadRequest_members },
14038 
14039 /* AddNodesItem */
14040 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 376},
14041  .typeIndex = UA_TYPES_ADDNODESITEM,
14042 #ifdef UA_ENABLE_TYPENAMES
14043  .typeName = "AddNodesItem",
14044 #endif
14045  .memSize = sizeof(UA_AddNodesItem),
14046  .builtin = false,
14047  .fixedSize = false,
14048  .overlayable = false,
14049  .binaryEncodingId = 378,
14050  .membersSize = 7,
14051  .members = AddNodesItem_members },
14052 
14053 /* ServerStatusDataType */
14054 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 862},
14055  .typeIndex = UA_TYPES_SERVERSTATUSDATATYPE,
14056 #ifdef UA_ENABLE_TYPENAMES
14057  .typeName = "ServerStatusDataType",
14058 #endif
14059  .memSize = sizeof(UA_ServerStatusDataType),
14060  .builtin = false,
14061  .fixedSize = false,
14062  .overlayable = false,
14063  .binaryEncodingId = 864,
14064  .membersSize = 6,
14065  .members = ServerStatusDataType_members },
14066 
14067 /* AddReferencesResponse */
14068 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 495},
14069  .typeIndex = UA_TYPES_ADDREFERENCESRESPONSE,
14070 #ifdef UA_ENABLE_TYPENAMES
14071  .typeName = "AddReferencesResponse",
14072 #endif
14073  .memSize = sizeof(UA_AddReferencesResponse),
14074  .builtin = false,
14075  .fixedSize = false,
14076  .overlayable = false,
14077  .binaryEncodingId = 497,
14078  .membersSize = 3,
14079  .members = AddReferencesResponse_members },
14080 
14081 /* TranslateBrowsePathsToNodeIdsResponse */
14082 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 555},
14084 #ifdef UA_ENABLE_TYPENAMES
14085  .typeName = "TranslateBrowsePathsToNodeIdsResponse",
14086 #endif
14087  .memSize = sizeof(UA_TranslateBrowsePathsToNodeIdsResponse),
14088  .builtin = false,
14089  .fixedSize = false,
14090  .overlayable = false,
14091  .binaryEncodingId = 557,
14092  .membersSize = 3,
14093  .members = TranslateBrowsePathsToNodeIdsResponse_members },
14094 
14095 /* DataChangeFilter */
14096 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 722},
14097  .typeIndex = UA_TYPES_DATACHANGEFILTER,
14098 #ifdef UA_ENABLE_TYPENAMES
14099  .typeName = "DataChangeFilter",
14100 #endif
14101  .memSize = sizeof(UA_DataChangeFilter),
14102  .builtin = false,
14103  .fixedSize = true,
14104  .overlayable = true && UA_BINARY_OVERLAYABLE_INTEGER && UA_BINARY_OVERLAYABLE_INTEGER && offsetof(UA_DataChangeFilter, deadbandType) == (offsetof(UA_DataChangeFilter, trigger) + sizeof(UA_DataChangeTrigger)) && UA_BINARY_OVERLAYABLE_FLOAT && offsetof(UA_DataChangeFilter, deadbandValue) == (offsetof(UA_DataChangeFilter, deadbandType) + sizeof(UA_UInt32)),
14105  .binaryEncodingId = 724,
14106  .membersSize = 3,
14107  .members = DataChangeFilter_members },
14108 
14109 /* ContentFilterElement */
14110 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 583},
14111  .typeIndex = UA_TYPES_CONTENTFILTERELEMENT,
14112 #ifdef UA_ENABLE_TYPENAMES
14113  .typeName = "ContentFilterElement",
14114 #endif
14115  .memSize = sizeof(UA_ContentFilterElement),
14116  .builtin = false,
14117  .fixedSize = false,
14118  .overlayable = false,
14119  .binaryEncodingId = 585,
14120  .membersSize = 2,
14121  .members = ContentFilterElement_members },
14122 
14123 /* CloseSessionResponse */
14124 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 474},
14125  .typeIndex = UA_TYPES_CLOSESESSIONRESPONSE,
14126 #ifdef UA_ENABLE_TYPENAMES
14127  .typeName = "CloseSessionResponse",
14128 #endif
14129  .memSize = sizeof(UA_CloseSessionResponse),
14130  .builtin = false,
14131  .fixedSize = false,
14132  .overlayable = false,
14133  .binaryEncodingId = 476,
14134  .membersSize = 1,
14135  .members = CloseSessionResponse_members },
14136 
14137 /* ApplicationDescription */
14138 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 308},
14139  .typeIndex = UA_TYPES_APPLICATIONDESCRIPTION,
14140 #ifdef UA_ENABLE_TYPENAMES
14141  .typeName = "ApplicationDescription",
14142 #endif
14143  .memSize = sizeof(UA_ApplicationDescription),
14144  .builtin = false,
14145  .fixedSize = false,
14146  .overlayable = false,
14147  .binaryEncodingId = 310,
14148  .membersSize = 7,
14149  .members = ApplicationDescription_members },
14150 
14151 /* ServiceFault */
14152 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 395},
14153  .typeIndex = UA_TYPES_SERVICEFAULT,
14154 #ifdef UA_ENABLE_TYPENAMES
14155  .typeName = "ServiceFault",
14156 #endif
14157  .memSize = sizeof(UA_ServiceFault),
14158  .builtin = false,
14159  .fixedSize = false,
14160  .overlayable = false,
14161  .binaryEncodingId = 397,
14162  .membersSize = 1,
14163  .members = ServiceFault_members },
14164 
14165 /* FindServersResponse */
14166 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 423},
14167  .typeIndex = UA_TYPES_FINDSERVERSRESPONSE,
14168 #ifdef UA_ENABLE_TYPENAMES
14169  .typeName = "FindServersResponse",
14170 #endif
14171  .memSize = sizeof(UA_FindServersResponse),
14172  .builtin = false,
14173  .fixedSize = false,
14174  .overlayable = false,
14175  .binaryEncodingId = 425,
14176  .membersSize = 2,
14177  .members = FindServersResponse_members },
14178 
14179 /* CreateMonitoredItemsRequest */
14180 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 749},
14182 #ifdef UA_ENABLE_TYPENAMES
14183  .typeName = "CreateMonitoredItemsRequest",
14184 #endif
14185  .memSize = sizeof(UA_CreateMonitoredItemsRequest),
14186  .builtin = false,
14187  .fixedSize = false,
14188  .overlayable = false,
14189  .binaryEncodingId = 751,
14190  .membersSize = 4,
14191  .members = CreateMonitoredItemsRequest_members },
14192 
14193 /* ContentFilter */
14194 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 586},
14195  .typeIndex = UA_TYPES_CONTENTFILTER,
14196 #ifdef UA_ENABLE_TYPENAMES
14197  .typeName = "ContentFilter",
14198 #endif
14199  .memSize = sizeof(UA_ContentFilter),
14200  .builtin = false,
14201  .fixedSize = false,
14202  .overlayable = false,
14203  .binaryEncodingId = 588,
14204  .membersSize = 1,
14205  .members = ContentFilter_members },
14206 
14207 /* QueryFirstResponse */
14208 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 616},
14209  .typeIndex = UA_TYPES_QUERYFIRSTRESPONSE,
14210 #ifdef UA_ENABLE_TYPENAMES
14211  .typeName = "QueryFirstResponse",
14212 #endif
14213  .memSize = sizeof(UA_QueryFirstResponse),
14214  .builtin = false,
14215  .fixedSize = false,
14216  .overlayable = false,
14217  .binaryEncodingId = 618,
14218  .membersSize = 6,
14219  .members = QueryFirstResponse_members },
14220 
14221 /* AddNodesRequest */
14222 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 486},
14223  .typeIndex = UA_TYPES_ADDNODESREQUEST,
14224 #ifdef UA_ENABLE_TYPENAMES
14225  .typeName = "AddNodesRequest",
14226 #endif
14227  .memSize = sizeof(UA_AddNodesRequest),
14228  .builtin = false,
14229  .fixedSize = false,
14230  .overlayable = false,
14231  .binaryEncodingId = 488,
14232  .membersSize = 2,
14233  .members = AddNodesRequest_members },
14234 
14235 /* BrowseRequest */
14236 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 525},
14237  .typeIndex = UA_TYPES_BROWSEREQUEST,
14238 #ifdef UA_ENABLE_TYPENAMES
14239  .typeName = "BrowseRequest",
14240 #endif
14241  .memSize = sizeof(UA_BrowseRequest),
14242  .builtin = false,
14243  .fixedSize = false,
14244  .overlayable = false,
14245  .binaryEncodingId = 527,
14246  .membersSize = 4,
14247  .members = BrowseRequest_members },
14248 
14249 /* BrowsePath */
14250 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 543},
14251  .typeIndex = UA_TYPES_BROWSEPATH,
14252 #ifdef UA_ENABLE_TYPENAMES
14253  .typeName = "BrowsePath",
14254 #endif
14255  .memSize = sizeof(UA_BrowsePath),
14256  .builtin = false,
14257  .fixedSize = false,
14258  .overlayable = false,
14259  .binaryEncodingId = 545,
14260  .membersSize = 2,
14261  .members = BrowsePath_members },
14262 
14263 /* BrowseResult */
14264 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 522},
14265  .typeIndex = UA_TYPES_BROWSERESULT,
14266 #ifdef UA_ENABLE_TYPENAMES
14267  .typeName = "BrowseResult",
14268 #endif
14269  .memSize = sizeof(UA_BrowseResult),
14270  .builtin = false,
14271  .fixedSize = false,
14272  .overlayable = false,
14273  .binaryEncodingId = 524,
14274  .membersSize = 3,
14275  .members = BrowseResult_members },
14276 
14277 /* CreateSessionRequest */
14278 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 459},
14279  .typeIndex = UA_TYPES_CREATESESSIONREQUEST,
14280 #ifdef UA_ENABLE_TYPENAMES
14281  .typeName = "CreateSessionRequest",
14282 #endif
14283  .memSize = sizeof(UA_CreateSessionRequest),
14284  .builtin = false,
14285  .fixedSize = false,
14286  .overlayable = false,
14287  .binaryEncodingId = 461,
14288  .membersSize = 9,
14289  .members = CreateSessionRequest_members },
14290 
14291 /* QueryDataDescription */
14292 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 570},
14293  .typeIndex = UA_TYPES_QUERYDATADESCRIPTION,
14294 #ifdef UA_ENABLE_TYPENAMES
14295  .typeName = "QueryDataDescription",
14296 #endif
14297  .memSize = sizeof(UA_QueryDataDescription),
14298  .builtin = false,
14299  .fixedSize = false,
14300  .overlayable = false,
14301  .binaryEncodingId = 572,
14302  .membersSize = 3,
14303  .members = QueryDataDescription_members },
14304 
14305 /* EndpointDescription */
14306 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 312},
14307  .typeIndex = UA_TYPES_ENDPOINTDESCRIPTION,
14308 #ifdef UA_ENABLE_TYPENAMES
14309  .typeName = "EndpointDescription",
14310 #endif
14311  .memSize = sizeof(UA_EndpointDescription),
14312  .builtin = false,
14313  .fixedSize = false,
14314  .overlayable = false,
14315  .binaryEncodingId = 314,
14316  .membersSize = 8,
14317  .members = EndpointDescription_members },
14318 
14319 /* GetEndpointsResponse */
14320 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 429},
14321  .typeIndex = UA_TYPES_GETENDPOINTSRESPONSE,
14322 #ifdef UA_ENABLE_TYPENAMES
14323  .typeName = "GetEndpointsResponse",
14324 #endif
14325  .memSize = sizeof(UA_GetEndpointsResponse),
14326  .builtin = false,
14327  .fixedSize = false,
14328  .overlayable = false,
14329  .binaryEncodingId = 431,
14330  .membersSize = 2,
14331  .members = GetEndpointsResponse_members },
14332 
14333 /* NodeTypeDescription */
14334 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 573},
14335  .typeIndex = UA_TYPES_NODETYPEDESCRIPTION,
14336 #ifdef UA_ENABLE_TYPENAMES
14337  .typeName = "NodeTypeDescription",
14338 #endif
14339  .memSize = sizeof(UA_NodeTypeDescription),
14340  .builtin = false,
14341  .fixedSize = false,
14342  .overlayable = false,
14343  .binaryEncodingId = 575,
14344  .membersSize = 3,
14345  .members = NodeTypeDescription_members },
14346 
14347 /* BrowseNextResponse */
14348 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 534},
14349  .typeIndex = UA_TYPES_BROWSENEXTRESPONSE,
14350 #ifdef UA_ENABLE_TYPENAMES
14351  .typeName = "BrowseNextResponse",
14352 #endif
14353  .memSize = sizeof(UA_BrowseNextResponse),
14354  .builtin = false,
14355  .fixedSize = false,
14356  .overlayable = false,
14357  .binaryEncodingId = 536,
14358  .membersSize = 3,
14359  .members = BrowseNextResponse_members },
14360 
14361 /* TranslateBrowsePathsToNodeIdsRequest */
14362 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 552},
14364 #ifdef UA_ENABLE_TYPENAMES
14365  .typeName = "TranslateBrowsePathsToNodeIdsRequest",
14366 #endif
14367  .memSize = sizeof(UA_TranslateBrowsePathsToNodeIdsRequest),
14368  .builtin = false,
14369  .fixedSize = false,
14370  .overlayable = false,
14371  .binaryEncodingId = 554,
14372  .membersSize = 2,
14373  .members = TranslateBrowsePathsToNodeIdsRequest_members },
14374 
14375 /* BrowseResponse */
14376 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 528},
14377  .typeIndex = UA_TYPES_BROWSERESPONSE,
14378 #ifdef UA_ENABLE_TYPENAMES
14379  .typeName = "BrowseResponse",
14380 #endif
14381  .memSize = sizeof(UA_BrowseResponse),
14382  .builtin = false,
14383  .fixedSize = false,
14384  .overlayable = false,
14385  .binaryEncodingId = 530,
14386  .membersSize = 3,
14387  .members = BrowseResponse_members },
14388 
14389 /* CreateSessionResponse */
14390 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 462},
14391  .typeIndex = UA_TYPES_CREATESESSIONRESPONSE,
14392 #ifdef UA_ENABLE_TYPENAMES
14393  .typeName = "CreateSessionResponse",
14394 #endif
14395  .memSize = sizeof(UA_CreateSessionResponse),
14396  .builtin = false,
14397  .fixedSize = false,
14398  .overlayable = false,
14399  .binaryEncodingId = 464,
14400  .membersSize = 10,
14401  .members = CreateSessionResponse_members },
14402 
14403 /* QueryFirstRequest */
14404 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 613},
14405  .typeIndex = UA_TYPES_QUERYFIRSTREQUEST,
14406 #ifdef UA_ENABLE_TYPENAMES
14407  .typeName = "QueryFirstRequest",
14408 #endif
14409  .memSize = sizeof(UA_QueryFirstRequest),
14410  .builtin = false,
14411  .fixedSize = false,
14412  .overlayable = false,
14413  .binaryEncodingId = 615,
14414  .membersSize = 6,
14415  .members = QueryFirstRequest_members },
14416 };
14417 
14418 
14419 /*********************************** amalgamated original file "/home/iosb/sw/open62541/build/src_generated/ua_transport_generated.c" ***********************************/
14420 
14421 /* Generated from Opc.Ua.Types.bsd, Custom.Opc.Ua.Transport.bsd with script /home/iosb/sw/open62541/tools/generate_datatypes.py
14422  * on host iosb-VirtualBox by user iosb at 2018-11-29 10:33:06 */
14423 
14424 
14425 /* SecureConversationMessageAbortBody */
14426 static UA_DataTypeMember SecureConversationMessageAbortBody_members[2] = {
14428 #ifdef UA_ENABLE_TYPENAMES
14429  .memberName = "error",
14430 #endif
14431  .namespaceZero = true,
14432  .padding = 0,
14433  .isArray = false
14434  },
14435  { .memberTypeIndex = UA_TYPES_STRING,
14436 #ifdef UA_ENABLE_TYPENAMES
14437  .memberName = "reason",
14438 #endif
14439  .namespaceZero = true,
14440  .padding = offsetof(UA_SecureConversationMessageAbortBody, reason) - offsetof(UA_SecureConversationMessageAbortBody, error) - sizeof(UA_UInt32),
14441  .isArray = false
14442  },};
14443 
14444 /* SecureConversationMessageFooter */
14445 static UA_DataTypeMember SecureConversationMessageFooter_members[2] = {
14447 #ifdef UA_ENABLE_TYPENAMES
14448  .memberName = "padding",
14449 #endif
14450  .namespaceZero = true,
14451  .padding = 0,
14452  .isArray = true
14453  },
14454  { .memberTypeIndex = UA_TYPES_BYTE,
14455 #ifdef UA_ENABLE_TYPENAMES
14456  .memberName = "signature",
14457 #endif
14458  .namespaceZero = true,
14459  .padding = offsetof(UA_SecureConversationMessageFooter, signature) - offsetof(UA_SecureConversationMessageFooter, padding) - sizeof(void*),
14460  .isArray = false
14461  },};
14462 
14463 /* TcpHelloMessage */
14464 static UA_DataTypeMember TcpHelloMessage_members[6] = {
14466 #ifdef UA_ENABLE_TYPENAMES
14467  .memberName = "protocolVersion",
14468 #endif
14469  .namespaceZero = true,
14470  .padding = 0,
14471  .isArray = false
14472  },
14473  { .memberTypeIndex = UA_TYPES_UINT32,
14474 #ifdef UA_ENABLE_TYPENAMES
14475  .memberName = "receiveBufferSize",
14476 #endif
14477  .namespaceZero = true,
14478  .padding = offsetof(UA_TcpHelloMessage, receiveBufferSize) - offsetof(UA_TcpHelloMessage, protocolVersion) - sizeof(UA_UInt32),
14479  .isArray = false
14480  },
14481  { .memberTypeIndex = UA_TYPES_UINT32,
14482 #ifdef UA_ENABLE_TYPENAMES
14483  .memberName = "sendBufferSize",
14484 #endif
14485  .namespaceZero = true,
14486  .padding = offsetof(UA_TcpHelloMessage, sendBufferSize) - offsetof(UA_TcpHelloMessage, receiveBufferSize) - sizeof(UA_UInt32),
14487  .isArray = false
14488  },
14489  { .memberTypeIndex = UA_TYPES_UINT32,
14490 #ifdef UA_ENABLE_TYPENAMES
14491  .memberName = "maxMessageSize",
14492 #endif
14493  .namespaceZero = true,
14494  .padding = offsetof(UA_TcpHelloMessage, maxMessageSize) - offsetof(UA_TcpHelloMessage, sendBufferSize) - sizeof(UA_UInt32),
14495  .isArray = false
14496  },
14497  { .memberTypeIndex = UA_TYPES_UINT32,
14498 #ifdef UA_ENABLE_TYPENAMES
14499  .memberName = "maxChunkCount",
14500 #endif
14501  .namespaceZero = true,
14502  .padding = offsetof(UA_TcpHelloMessage, maxChunkCount) - offsetof(UA_TcpHelloMessage, maxMessageSize) - sizeof(UA_UInt32),
14503  .isArray = false
14504  },
14505  { .memberTypeIndex = UA_TYPES_STRING,
14506 #ifdef UA_ENABLE_TYPENAMES
14507  .memberName = "endpointUrl",
14508 #endif
14509  .namespaceZero = true,
14510  .padding = offsetof(UA_TcpHelloMessage, endpointUrl) - offsetof(UA_TcpHelloMessage, maxChunkCount) - sizeof(UA_UInt32),
14511  .isArray = false
14512  },};
14513 
14514 /* TcpErrorMessage */
14515 static UA_DataTypeMember TcpErrorMessage_members[2] = {
14517 #ifdef UA_ENABLE_TYPENAMES
14518  .memberName = "error",
14519 #endif
14520  .namespaceZero = true,
14521  .padding = 0,
14522  .isArray = false
14523  },
14524  { .memberTypeIndex = UA_TYPES_STRING,
14525 #ifdef UA_ENABLE_TYPENAMES
14526  .memberName = "reason",
14527 #endif
14528  .namespaceZero = true,
14529  .padding = offsetof(UA_TcpErrorMessage, reason) - offsetof(UA_TcpErrorMessage, error) - sizeof(UA_UInt32),
14530  .isArray = false
14531  },};
14532 
14533 /* MessageType */
14534 static UA_DataTypeMember MessageType_members[1] = {
14536 #ifdef UA_ENABLE_TYPENAMES
14537  .memberName = "",
14538 #endif
14539  .namespaceZero = true,
14540  .padding = 0,
14541  .isArray = false
14542  },};
14543 
14544 /* AsymmetricAlgorithmSecurityHeader */
14545 static UA_DataTypeMember AsymmetricAlgorithmSecurityHeader_members[3] = {
14547 #ifdef UA_ENABLE_TYPENAMES
14548  .memberName = "securityPolicyUri",
14549 #endif
14550  .namespaceZero = true,
14551  .padding = 0,
14552  .isArray = false
14553  },
14554  { .memberTypeIndex = UA_TYPES_BYTESTRING,
14555 #ifdef UA_ENABLE_TYPENAMES
14556  .memberName = "senderCertificate",
14557 #endif
14558  .namespaceZero = true,
14559  .padding = offsetof(UA_AsymmetricAlgorithmSecurityHeader, senderCertificate) - offsetof(UA_AsymmetricAlgorithmSecurityHeader, securityPolicyUri) - sizeof(UA_ByteString),
14560  .isArray = false
14561  },
14562  { .memberTypeIndex = UA_TYPES_BYTESTRING,
14563 #ifdef UA_ENABLE_TYPENAMES
14564  .memberName = "receiverCertificateThumbprint",
14565 #endif
14566  .namespaceZero = true,
14567  .padding = offsetof(UA_AsymmetricAlgorithmSecurityHeader, receiverCertificateThumbprint) - offsetof(UA_AsymmetricAlgorithmSecurityHeader, senderCertificate) - sizeof(UA_ByteString),
14568  .isArray = false
14569  },};
14570 
14571 /* TcpAcknowledgeMessage */
14572 static UA_DataTypeMember TcpAcknowledgeMessage_members[5] = {
14574 #ifdef UA_ENABLE_TYPENAMES
14575  .memberName = "protocolVersion",
14576 #endif
14577  .namespaceZero = true,
14578  .padding = 0,
14579  .isArray = false
14580  },
14581  { .memberTypeIndex = UA_TYPES_UINT32,
14582 #ifdef UA_ENABLE_TYPENAMES
14583  .memberName = "receiveBufferSize",
14584 #endif
14585  .namespaceZero = true,
14586  .padding = offsetof(UA_TcpAcknowledgeMessage, receiveBufferSize) - offsetof(UA_TcpAcknowledgeMessage, protocolVersion) - sizeof(UA_UInt32),
14587  .isArray = false
14588  },
14589  { .memberTypeIndex = UA_TYPES_UINT32,
14590 #ifdef UA_ENABLE_TYPENAMES
14591  .memberName = "sendBufferSize",
14592 #endif
14593  .namespaceZero = true,
14594  .padding = offsetof(UA_TcpAcknowledgeMessage, sendBufferSize) - offsetof(UA_TcpAcknowledgeMessage, receiveBufferSize) - sizeof(UA_UInt32),
14595  .isArray = false
14596  },
14597  { .memberTypeIndex = UA_TYPES_UINT32,
14598 #ifdef UA_ENABLE_TYPENAMES
14599  .memberName = "maxMessageSize",
14600 #endif
14601  .namespaceZero = true,
14602  .padding = offsetof(UA_TcpAcknowledgeMessage, maxMessageSize) - offsetof(UA_TcpAcknowledgeMessage, sendBufferSize) - sizeof(UA_UInt32),
14603  .isArray = false
14604  },
14605  { .memberTypeIndex = UA_TYPES_UINT32,
14606 #ifdef UA_ENABLE_TYPENAMES
14607  .memberName = "maxChunkCount",
14608 #endif
14609  .namespaceZero = true,
14610  .padding = offsetof(UA_TcpAcknowledgeMessage, maxChunkCount) - offsetof(UA_TcpAcknowledgeMessage, maxMessageSize) - sizeof(UA_UInt32),
14611  .isArray = false
14612  },};
14613 
14614 /* SequenceHeader */
14615 static UA_DataTypeMember SequenceHeader_members[2] = {
14617 #ifdef UA_ENABLE_TYPENAMES
14618  .memberName = "sequenceNumber",
14619 #endif
14620  .namespaceZero = true,
14621  .padding = 0,
14622  .isArray = false
14623  },
14624  { .memberTypeIndex = UA_TYPES_UINT32,
14625 #ifdef UA_ENABLE_TYPENAMES
14626  .memberName = "requestId",
14627 #endif
14628  .namespaceZero = true,
14629  .padding = offsetof(UA_SequenceHeader, requestId) - offsetof(UA_SequenceHeader, sequenceNumber) - sizeof(UA_UInt32),
14630  .isArray = false
14631  },};
14632 
14633 /* TcpMessageHeader */
14634 static UA_DataTypeMember TcpMessageHeader_members[2] = {
14636 #ifdef UA_ENABLE_TYPENAMES
14637  .memberName = "messageTypeAndChunkType",
14638 #endif
14639  .namespaceZero = true,
14640  .padding = 0,
14641  .isArray = false
14642  },
14643  { .memberTypeIndex = UA_TYPES_UINT32,
14644 #ifdef UA_ENABLE_TYPENAMES
14645  .memberName = "messageSize",
14646 #endif
14647  .namespaceZero = true,
14648  .padding = offsetof(UA_TcpMessageHeader, messageSize) - offsetof(UA_TcpMessageHeader, messageTypeAndChunkType) - sizeof(UA_UInt32),
14649  .isArray = false
14650  },};
14651 
14652 /* ChunkType */
14653 static UA_DataTypeMember ChunkType_members[1] = {
14655 #ifdef UA_ENABLE_TYPENAMES
14656  .memberName = "",
14657 #endif
14658  .namespaceZero = true,
14659  .padding = 0,
14660  .isArray = false
14661  },};
14662 
14663 /* SymmetricAlgorithmSecurityHeader */
14664 static UA_DataTypeMember SymmetricAlgorithmSecurityHeader_members[1] = {
14666 #ifdef UA_ENABLE_TYPENAMES
14667  .memberName = "tokenId",
14668 #endif
14669  .namespaceZero = true,
14670  .padding = 0,
14671  .isArray = false
14672  },};
14673 
14674 /* SecureConversationMessageHeader */
14675 static UA_DataTypeMember SecureConversationMessageHeader_members[2] = {
14677 #ifdef UA_ENABLE_TYPENAMES
14678  .memberName = "messageHeader",
14679 #endif
14680  .namespaceZero = false,
14681  .padding = 0,
14682  .isArray = false
14683  },
14684  { .memberTypeIndex = UA_TYPES_UINT32,
14685 #ifdef UA_ENABLE_TYPENAMES
14686  .memberName = "secureChannelId",
14687 #endif
14688  .namespaceZero = true,
14689  .padding = offsetof(UA_SecureConversationMessageHeader, secureChannelId) - offsetof(UA_SecureConversationMessageHeader, messageHeader) - sizeof(UA_TcpMessageHeader),
14690  .isArray = false
14691  },};
14692 const UA_DataType UA_TRANSPORT[UA_TRANSPORT_COUNT] = {
14693 
14694 /* SecureConversationMessageAbortBody */
14695 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 0},
14697 #ifdef UA_ENABLE_TYPENAMES
14698  .typeName = "SecureConversationMessageAbortBody",
14699 #endif
14700  .memSize = sizeof(UA_SecureConversationMessageAbortBody),
14701  .builtin = false,
14702  .fixedSize = false,
14703  .overlayable = false,
14704  .binaryEncodingId = 0,
14705  .membersSize = 2,
14706  .members = SecureConversationMessageAbortBody_members },
14707 
14708 /* SecureConversationMessageFooter */
14709 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 0},
14711 #ifdef UA_ENABLE_TYPENAMES
14712  .typeName = "SecureConversationMessageFooter",
14713 #endif
14714  .memSize = sizeof(UA_SecureConversationMessageFooter),
14715  .builtin = false,
14716  .fixedSize = false,
14717  .overlayable = false,
14718  .binaryEncodingId = 0,
14719  .membersSize = 2,
14720  .members = SecureConversationMessageFooter_members },
14721 
14722 /* TcpHelloMessage */
14723 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 0},
14724  .typeIndex = UA_TRANSPORT_TCPHELLOMESSAGE,
14725 #ifdef UA_ENABLE_TYPENAMES
14726  .typeName = "TcpHelloMessage",
14727 #endif
14728  .memSize = sizeof(UA_TcpHelloMessage),
14729  .builtin = false,
14730  .fixedSize = false,
14731  .overlayable = false,
14732  .binaryEncodingId = 0,
14733  .membersSize = 6,
14734  .members = TcpHelloMessage_members },
14735 
14736 /* TcpErrorMessage */
14737 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 0},
14738  .typeIndex = UA_TRANSPORT_TCPERRORMESSAGE,
14739 #ifdef UA_ENABLE_TYPENAMES
14740  .typeName = "TcpErrorMessage",
14741 #endif
14742  .memSize = sizeof(UA_TcpErrorMessage),
14743  .builtin = false,
14744  .fixedSize = false,
14745  .overlayable = false,
14746  .binaryEncodingId = 0,
14747  .membersSize = 2,
14748  .members = TcpErrorMessage_members },
14749 
14750 /* MessageType */
14751 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 0},
14752  .typeIndex = UA_TYPES_INT32,
14753 #ifdef UA_ENABLE_TYPENAMES
14754  .typeName = "MessageType",
14755 #endif
14756  .memSize = sizeof(UA_MessageType),
14757  .builtin = true,
14758  .fixedSize = true,
14759  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
14760  .binaryEncodingId = 0,
14761  .membersSize = 1,
14762  .members = MessageType_members },
14763 
14764 /* AsymmetricAlgorithmSecurityHeader */
14765 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 0},
14767 #ifdef UA_ENABLE_TYPENAMES
14768  .typeName = "AsymmetricAlgorithmSecurityHeader",
14769 #endif
14770  .memSize = sizeof(UA_AsymmetricAlgorithmSecurityHeader),
14771  .builtin = false,
14772  .fixedSize = false,
14773  .overlayable = false,
14774  .binaryEncodingId = 0,
14775  .membersSize = 3,
14776  .members = AsymmetricAlgorithmSecurityHeader_members },
14777 
14778 /* TcpAcknowledgeMessage */
14779 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 0},
14781 #ifdef UA_ENABLE_TYPENAMES
14782  .typeName = "TcpAcknowledgeMessage",
14783 #endif
14784  .memSize = sizeof(UA_TcpAcknowledgeMessage),
14785  .builtin = false,
14786  .fixedSize = true,
14787  .overlayable = true && UA_BINARY_OVERLAYABLE_INTEGER && UA_BINARY_OVERLAYABLE_INTEGER && offsetof(UA_TcpAcknowledgeMessage, receiveBufferSize) == (offsetof(UA_TcpAcknowledgeMessage, protocolVersion) + sizeof(UA_UInt32)) && UA_BINARY_OVERLAYABLE_INTEGER && offsetof(UA_TcpAcknowledgeMessage, sendBufferSize) == (offsetof(UA_TcpAcknowledgeMessage, receiveBufferSize) + sizeof(UA_UInt32)) && UA_BINARY_OVERLAYABLE_INTEGER && offsetof(UA_TcpAcknowledgeMessage, maxMessageSize) == (offsetof(UA_TcpAcknowledgeMessage, sendBufferSize) + sizeof(UA_UInt32)) && UA_BINARY_OVERLAYABLE_INTEGER && offsetof(UA_TcpAcknowledgeMessage, maxChunkCount) == (offsetof(UA_TcpAcknowledgeMessage, maxMessageSize) + sizeof(UA_UInt32)),
14788  .binaryEncodingId = 0,
14789  .membersSize = 5,
14790  .members = TcpAcknowledgeMessage_members },
14791 
14792 /* SequenceHeader */
14793 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 0},
14794  .typeIndex = UA_TRANSPORT_SEQUENCEHEADER,
14795 #ifdef UA_ENABLE_TYPENAMES
14796  .typeName = "SequenceHeader",
14797 #endif
14798  .memSize = sizeof(UA_SequenceHeader),
14799  .builtin = false,
14800  .fixedSize = true,
14801  .overlayable = true && UA_BINARY_OVERLAYABLE_INTEGER && UA_BINARY_OVERLAYABLE_INTEGER && offsetof(UA_SequenceHeader, requestId) == (offsetof(UA_SequenceHeader, sequenceNumber) + sizeof(UA_UInt32)),
14802  .binaryEncodingId = 0,
14803  .membersSize = 2,
14804  .members = SequenceHeader_members },
14805 
14806 /* TcpMessageHeader */
14807 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 0},
14808  .typeIndex = UA_TRANSPORT_TCPMESSAGEHEADER,
14809 #ifdef UA_ENABLE_TYPENAMES
14810  .typeName = "TcpMessageHeader",
14811 #endif
14812  .memSize = sizeof(UA_TcpMessageHeader),
14813  .builtin = false,
14814  .fixedSize = true,
14815  .overlayable = true && UA_BINARY_OVERLAYABLE_INTEGER && UA_BINARY_OVERLAYABLE_INTEGER && offsetof(UA_TcpMessageHeader, messageSize) == (offsetof(UA_TcpMessageHeader, messageTypeAndChunkType) + sizeof(UA_UInt32)),
14816  .binaryEncodingId = 0,
14817  .membersSize = 2,
14818  .members = TcpMessageHeader_members },
14819 
14820 /* ChunkType */
14821 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 0},
14822  .typeIndex = UA_TYPES_INT32,
14823 #ifdef UA_ENABLE_TYPENAMES
14824  .typeName = "ChunkType",
14825 #endif
14826  .memSize = sizeof(UA_ChunkType),
14827  .builtin = true,
14828  .fixedSize = true,
14829  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
14830  .binaryEncodingId = 0,
14831  .membersSize = 1,
14832  .members = ChunkType_members },
14833 
14834 /* SymmetricAlgorithmSecurityHeader */
14835 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 0},
14837 #ifdef UA_ENABLE_TYPENAMES
14838  .typeName = "SymmetricAlgorithmSecurityHeader",
14839 #endif
14840  .memSize = sizeof(UA_SymmetricAlgorithmSecurityHeader),
14841  .builtin = false,
14842  .fixedSize = true,
14843  .overlayable = true && UA_BINARY_OVERLAYABLE_INTEGER,
14844  .binaryEncodingId = 0,
14845  .membersSize = 1,
14846  .members = SymmetricAlgorithmSecurityHeader_members },
14847 
14848 /* SecureConversationMessageHeader */
14849 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 0},
14851 #ifdef UA_ENABLE_TYPENAMES
14852  .typeName = "SecureConversationMessageHeader",
14853 #endif
14854  .memSize = sizeof(UA_SecureConversationMessageHeader),
14855  .builtin = false,
14856  .fixedSize = true,
14857  .overlayable = true && true && UA_BINARY_OVERLAYABLE_INTEGER && UA_BINARY_OVERLAYABLE_INTEGER && offsetof(UA_TcpMessageHeader, messageSize) == (offsetof(UA_TcpMessageHeader, messageTypeAndChunkType) + sizeof(UA_UInt32)) && UA_BINARY_OVERLAYABLE_INTEGER && offsetof(UA_SecureConversationMessageHeader, secureChannelId) == (offsetof(UA_SecureConversationMessageHeader, messageHeader) + sizeof(UA_TcpMessageHeader)),
14858  .binaryEncodingId = 0,
14859  .membersSize = 2,
14860  .members = SecureConversationMessageHeader_members },
14861 };
14862 
14863 
14864 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/ua_connection.c" ***********************************/
14865 
14866 /* This Source Code Form is subject to the terms of the Mozilla Public
14867 * License, v. 2.0. If a copy of the MPL was not distributed with this
14868 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
14869 
14870 
14872  UA_ByteString_deleteMembers(&connection->incompleteMessage);
14873 }
14874 
14877  UA_Boolean *realloced) {
14879 
14880  /* We have a stored an incomplete chunk. Concat the received message to the end.
14881  * After this block, connection->incompleteMessage is always empty. */
14882  if(connection->incompleteMessage.length > 0) {
14883  size_t length = connection->incompleteMessage.length + message->length;
14884  UA_Byte *data = (UA_Byte*)UA_realloc(connection->incompleteMessage.data, length);
14885  if(!data) {
14887  goto cleanup;
14888  }
14889  memcpy(&data[connection->incompleteMessage.length], message->data, message->length);
14890  connection->releaseRecvBuffer(connection, message);
14891  message->data = data;
14892  message->length = length;
14893  *realloced = true;
14894  connection->incompleteMessage = UA_BYTESTRING_NULL;
14895  }
14896 
14897  /* Loop over the chunks in the received buffer */
14898  size_t complete_until = 0; /* the received complete chunks end at this point */
14899  UA_Boolean garbage_end = false; /* garbage after the last complete message */
14900  while(message->length - complete_until >= 8) {
14901  /* Check the message type */
14902  UA_UInt32 msgtype = (UA_UInt32)message->data[complete_until] +
14903  ((UA_UInt32)message->data[complete_until+1] << 8) +
14904  ((UA_UInt32)message->data[complete_until+2] << 16);
14905  if(msgtype != ('M' + ('S' << 8) + ('G' << 16)) &&
14906  msgtype != ('E' + ('R' << 8) + ('R' << 16)) &&
14907  msgtype != ('O' + ('P' << 8) + ('N' << 16)) &&
14908  msgtype != ('H' + ('E' << 8) + ('L' << 16)) &&
14909  msgtype != ('A' + ('C' << 8) + ('K' << 16)) &&
14910  msgtype != ('C' + ('L' << 8) + ('O' << 16))) {
14911  garbage_end = true; /* the message type is not recognized */
14912  break;
14913  }
14914 
14915  /* Decode the length of the chunk */
14916  UA_UInt32 chunk_length = 0;
14917  size_t length_pos = complete_until + 4;
14918  UA_StatusCode decode_retval = UA_UInt32_decodeBinary(message, &length_pos, &chunk_length);
14919 
14920  /* The message size is not allowed. Throw the remaining bytestring away */
14921  if(decode_retval != UA_STATUSCODE_GOOD ||
14922  chunk_length < 16 ||
14923  chunk_length > connection->localConf.recvBufferSize) {
14924  garbage_end = true;
14925  break;
14926  }
14927 
14928  /* The chunk is okay but incomplete. Store the end. */
14929  if(chunk_length + complete_until > message->length)
14930  break;
14931 
14932  complete_until += chunk_length; /* Go to the next chunk */
14933  }
14934 
14935  /* Separate incomplete chunks */
14936  if(complete_until != message->length) {
14937  /* Garbage after the last good chunk. No need to keep a buffer */
14938  if(garbage_end) {
14939  if(complete_until == 0)
14940  goto cleanup; /* All garbage, only happens on messages from the network layer */
14941  message->length = complete_until;
14942  return UA_STATUSCODE_GOOD;
14943  }
14944 
14945  /* No good chunk, only an incomplete one */
14946  if(complete_until == 0) {
14947  if(!*realloced) {
14948  retval = UA_ByteString_allocBuffer(&connection->incompleteMessage, message->length);
14949  if(retval != UA_STATUSCODE_GOOD)
14950  goto cleanup;
14951  memcpy(connection->incompleteMessage.data, message->data, message->length);
14952  connection->releaseRecvBuffer(connection, message);
14953  *realloced = true;
14954  } else {
14955  connection->incompleteMessage = *message;
14956  *message = UA_BYTESTRING_NULL;
14957  }
14958  return UA_STATUSCODE_GOOD;
14959  }
14960 
14961  /* At least one good chunk and an incomplete one */
14962  size_t incomplete_length = message->length - complete_until;
14963  retval = UA_ByteString_allocBuffer(&connection->incompleteMessage, incomplete_length);
14964  if(retval != UA_STATUSCODE_GOOD)
14965  goto cleanup;
14966  memcpy(connection->incompleteMessage.data,
14967  &message->data[complete_until], incomplete_length);
14968  message->length = complete_until;
14969  }
14970 
14971  return UA_STATUSCODE_GOOD;
14972 
14973  cleanup:
14974  if(!*realloced)
14975  connection->releaseRecvBuffer(connection, message);
14976  UA_ByteString_deleteMembers(&connection->incompleteMessage);
14977  return retval;
14978 }
14979 
14982  UA_Boolean *realloced, UA_UInt32 timeout) {
14984  UA_DateTime maxDate = now + (timeout * UA_MSEC_TO_DATETIME);
14985  *realloced = false;
14986 
14988  while(true) {
14989  /* Listen for messages to arrive */
14990  retval = connection->recv(connection, chunks, timeout);
14991 
14992  /* Get complete chunks and return */
14993  retval |= UA_Connection_completeMessages(connection, chunks, realloced);
14994  if(retval != UA_STATUSCODE_GOOD || chunks->length > 0)
14995  break;
14996 
14997  /* We received a message. But the chunk is incomplete. Compute the
14998  * remaining timeout. */
14999  now = UA_DateTime_nowMonotonic();
15000  if(now > maxDate)
15002  timeout = (UA_UInt32)((maxDate - now) / UA_MSEC_TO_DATETIME);
15003  }
15004  return retval;
15005 }
15006 
15007 
15009  UA_SecureChannel *channel = connection->channel;
15010  if(channel)
15011  /* only replace when the channel points to this connection */
15012  UA_atomic_cmpxchg((void**)&channel->connection, connection, NULL);
15013  UA_atomic_xchg((void**)&connection->channel, NULL);
15014 }
15015 
15016 // TODO: Return an error code
15017 void
15019  UA_SecureChannel *channel) {
15020  if(UA_atomic_cmpxchg((void**)&channel->connection, NULL, connection) == NULL)
15021  UA_atomic_xchg((void**)&connection->channel, (void*)channel);
15022 }
15023 
15025 UA_EndpointUrl_split_ptr(const char *endpointUrl, char *hostname,
15026  const char ** port, const char **path) {
15027  if (!endpointUrl || !hostname)
15029 
15030  size_t urlLength = strlen(endpointUrl);
15031  if(urlLength < 10 || urlLength >= 256)
15033 
15034  if(strncmp(endpointUrl, "opc.tcp://", 10) != 0)
15036 
15037  if (urlLength == 10) {
15038  hostname[0] = '\0';
15039  port = NULL;
15040  *path = NULL;
15041  }
15042 
15043  /* where does the port begin? */
15044  size_t portpos = 10;
15045  // opc.tcp://[2001:0db8:85a3::8a2e:0370:7334]:1234/path
15046  // if ip6, then end not found, otherwise we are fine
15047  UA_Boolean ip6_end_found = endpointUrl[portpos] != '[';
15048  for(; portpos < urlLength; ++portpos) {
15049  if (!ip6_end_found) {
15050  if (endpointUrl[portpos] == ']')
15051  ip6_end_found = UA_TRUE;
15052  continue;
15053  }
15054 
15055  if(endpointUrl[portpos] == ':' || endpointUrl[portpos] == '/')
15056  break;
15057  }
15058 
15059  memcpy(hostname, &endpointUrl[10], portpos - 10);
15060  hostname[portpos-10] = 0;
15061 
15062  if(port) {
15063  if (portpos < urlLength - 1) {
15064  if (endpointUrl[portpos] == '/')
15065  *port = NULL;
15066  else
15067  *port = &endpointUrl[portpos + 1];
15068  } else {
15069  *port = NULL;
15070  }
15071  }
15072 
15073  if(path) {
15074  size_t pathpos = portpos < urlLength ? portpos : 10;
15075  for(; pathpos < urlLength; ++pathpos) {
15076  if(endpointUrl[pathpos] == '/')
15077  break;
15078  }
15079  if (pathpos < urlLength-1)
15080  *path = &endpointUrl[pathpos+1]; // do not include slash in path
15081  else
15082  *path = NULL;
15083  }
15084 
15085  return UA_STATUSCODE_GOOD;
15086 }
15087 
15088 
15090 UA_EndpointUrl_split(const char *endpointUrl, char *hostname,
15091  UA_UInt16 * port, const char ** path) {
15092  const char* portTmp = NULL;
15093  const char* pathTmp = NULL;
15094  UA_StatusCode retval = UA_EndpointUrl_split_ptr(endpointUrl, hostname, &portTmp, &pathTmp);
15095  if(retval != UA_STATUSCODE_GOOD) {
15096  if(hostname)
15097  hostname[0] = '\0';
15098  return retval;
15099  }
15100  if(!port && !path)
15101  return UA_STATUSCODE_GOOD;
15102 
15103  char portStr[6];
15104  portStr[0] = '\0';
15105  if(portTmp) {
15106  size_t portLen;
15107  if (pathTmp)
15108  portLen = (size_t)(pathTmp-portTmp-1);
15109  else
15110  portLen = strlen(portTmp);
15111 
15112  if (portLen > 5) // max is 65535
15114 
15115  memcpy(portStr, portTmp, portLen);
15116  portStr[portLen]='\0';
15117 
15118  if(port) {
15119  for (size_t i=0; i<6; ++i) {
15120  if (portStr[i] == 0)
15121  break;
15122  if (portStr[i] < '0' || portStr[i] > '9')
15124  }
15125 
15126  UA_UInt32 p;
15127  UA_readNumber((UA_Byte*)portStr, 6, &p);
15128  if (p>65535)
15130  *port = (UA_UInt16)p;
15131  }
15132  } else {
15133  if (port)
15134  *port = 0;
15135  }
15136  if (path)
15137  *path = pathTmp;
15138  return UA_STATUSCODE_GOOD;
15139 }
15140 
15141 size_t UA_readNumber(UA_Byte *buf, size_t buflen, UA_UInt32 *number) {
15142  if (!buf)
15143  return 0;
15144  UA_UInt32 n = 0;
15145  size_t progress = 0;
15146  /* read numbers until the end or a non-number character appears */
15147  while(progress < buflen) {
15148  UA_Byte c = buf[progress];
15149  if('0' > c || '9' < c)
15150  break;
15151  n = (n*10) + (UA_UInt32)(c-'0');
15152  ++progress;
15153  }
15154  *number = n;
15155  return progress;
15156 }
15157 
15158 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/ua_securechannel.c" ***********************************/
15159 
15160 /* This Source Code Form is subject to the terms of the Mozilla Public
15161 * License, v. 2.0. If a copy of the MPL was not distributed with this
15162 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
15163 
15164 
15165 #define UA_SECURE_MESSAGE_HEADER_LENGTH 24
15166 
15168  memset(channel, 0, sizeof(UA_SecureChannel));
15169  /* Linked lists are also initialized by zeroing out */
15170  /* LIST_INIT(&channel->sessions); */
15171  /* LIST_INIT(&channel->chunks); */
15172 }
15173 
15175  /* Delete members */
15176  UA_AsymmetricAlgorithmSecurityHeader_deleteMembers(&channel->serverAsymAlgSettings);
15177  UA_ByteString_deleteMembers(&channel->serverNonce);
15178  UA_AsymmetricAlgorithmSecurityHeader_deleteMembers(&channel->clientAsymAlgSettings);
15179  UA_ByteString_deleteMembers(&channel->clientNonce);
15180  UA_ChannelSecurityToken_deleteMembers(&channel->securityToken);
15181  UA_ChannelSecurityToken_deleteMembers(&channel->nextSecurityToken);
15182 
15183  /* Detach from the channel */
15184  if(channel->connection)
15186 
15187  /* Remove session pointers (not the sessions) */
15188  struct SessionEntry *se, *temp;
15189  LIST_FOREACH_SAFE(se, &channel->sessions, pointers, temp) {
15190  if(se->session)
15191  se->session->channel = NULL;
15192  LIST_REMOVE(se, pointers);
15193  UA_free(se);
15194  }
15195 
15196  /* Remove the buffered chunks */
15197  struct ChunkEntry *ch, *temp_ch;
15198  LIST_FOREACH_SAFE(ch, &channel->chunks, pointers, temp_ch) {
15199  UA_ByteString_deleteMembers(&ch->bytes);
15200  LIST_REMOVE(ch, pointers);
15201  UA_free(ch);
15202  }
15203 }
15204 
15205 //TODO implement real nonce generator - DUMMY function
15207  if(!(nonce->data = UA_malloc(1)))
15209  nonce->length = 1;
15210  nonce->data[0] = 'a';
15211  return UA_STATUSCODE_GOOD;
15212 }
15213 
15214 #if (__GNUC__ >= 4 && __GNUC_MINOR__ >= 6)
15215 #pragma GCC diagnostic push
15216 #pragma GCC diagnostic ignored "-Wextra"
15217 #pragma GCC diagnostic ignored "-Wcast-qual"
15218 #pragma GCC diagnostic ignored "-Wunused-value"
15219 #endif
15220 
15221 void UA_SecureChannel_attachSession(UA_SecureChannel *channel, UA_Session *session) {
15222  struct SessionEntry *se = UA_malloc(sizeof(struct SessionEntry));
15223  if(!se)
15224  return;
15225  se->session = session;
15226  if(UA_atomic_cmpxchg((void**)&session->channel, NULL, channel) != NULL) {
15227  UA_free(se);
15228  return;
15229  }
15230  LIST_INSERT_HEAD(&channel->sessions, se, pointers);
15231 }
15232 
15233 #if (__GNUC__ >= 4 && __GNUC_MINOR__ >= 6)
15234 #pragma GCC diagnostic pop
15235 #endif
15236 
15237 void UA_SecureChannel_detachSession(UA_SecureChannel *channel, UA_Session *session) {
15238  if(session)
15239  session->channel = NULL;
15240  struct SessionEntry *se;
15241  LIST_FOREACH(se, &channel->sessions, pointers) {
15242  if(se->session == session)
15243  break;
15244  }
15245  if(!se)
15246  return;
15247  LIST_REMOVE(se, pointers);
15248  UA_free(se);
15249 }
15250 
15252  struct SessionEntry *se;
15253  LIST_FOREACH(se, &channel->sessions, pointers) {
15254  if(UA_NodeId_equal(&se->session->authenticationToken, token))
15255  break;
15256  }
15257  if(!se)
15258  return NULL;
15259  return se->session;
15260 }
15261 
15263  if(channel->nextSecurityToken.tokenId == 0) //no security token issued
15264  return;
15265 
15266  //FIXME: not thread-safe
15267  memcpy(&channel->securityToken, &channel->nextSecurityToken,
15268  sizeof(UA_ChannelSecurityToken));
15269  UA_ChannelSecurityToken_init(&channel->nextSecurityToken);
15270 }
15271 
15272 /***********************/
15273 /* Send Binary Message */
15274 /***********************/
15275 
15276 static UA_StatusCode
15277 UA_SecureChannel_sendChunk(UA_ChunkInfo *ci, UA_ByteString *dst, size_t offset) {
15278  UA_SecureChannel *channel = ci->channel;
15279  UA_Connection *connection = channel->connection;
15280  if(!connection)
15282 
15283  /* adjust the buffer where the header was hidden */
15284  dst->data = &dst->data[-UA_SECURE_MESSAGE_HEADER_LENGTH];
15287 
15288  if(ci->messageSizeSoFar + offset > connection->remoteConf.maxMessageSize &&
15289  connection->remoteConf.maxMessageSize > 0)
15291  if(++ci->chunksSoFar > connection->remoteConf.maxChunkCount &&
15292  connection->remoteConf.maxChunkCount > 0)
15294 
15295  /* Prepare the chunk headers */
15297  respHeader.secureChannelId = channel->securityToken.channelId;
15299  if(ci->errorCode == UA_STATUSCODE_GOOD) {
15300  if(ci->final)
15302  else
15304  } else {
15305  /* abort message */
15306  ci->final = true; /* mark as finished */
15308  UA_String errorMsg;
15309  UA_String_init(&errorMsg);
15311  UA_UInt32_encodeBinary(&ci->errorCode, dst, &offset);
15312  UA_String_encodeBinary(&errorMsg, dst, &offset);
15313  }
15314  respHeader.messageHeader.messageSize = (UA_UInt32)offset;
15315  ci->messageSizeSoFar += offset;
15316 
15317  /* Encode the header at the beginning of the buffer */
15319  symSecHeader.tokenId = channel->securityToken.tokenId;
15320  UA_SequenceHeader seqHeader;
15321  seqHeader.requestId = ci->requestId;
15322  seqHeader.sequenceNumber = UA_atomic_add(&channel->sendSequenceNumber, 1);
15323  size_t offset_header = 0;
15324  UA_SecureConversationMessageHeader_encodeBinary(&respHeader, dst, &offset_header);
15325  UA_SymmetricAlgorithmSecurityHeader_encodeBinary(&symSecHeader, dst, &offset_header);
15326  UA_SequenceHeader_encodeBinary(&seqHeader, dst, &offset_header);
15327 
15328  /* Send the chunk, the buffer is freed in the network layer */
15329  dst->length = offset; /* set the buffer length to the content length */
15330  connection->send(channel->connection, dst);
15331 
15332  /* Replace with the buffer for the next chunk */
15333  if(!ci->final) {
15334  UA_StatusCode retval =
15335  connection->getSendBuffer(connection, connection->localConf.sendBufferSize, dst);
15336  if(retval != UA_STATUSCODE_GOOD)
15337  return retval;
15338  /* Forward the data pointer so that the payload is encoded after the message header.
15339  * TODO: This works but is a bit too clever. Instead, we could return an offset to the
15340  * binary encoding exchangeBuffer function. */
15343  }
15344  return ci->errorCode;
15345 }
15346 
15349  const void *content, const UA_DataType *contentType) {
15350  if(!channel)
15352 
15353  UA_Connection *connection = channel->connection;
15354  if(!connection)
15356 
15357  /* Allocate the message buffer */
15358  UA_ByteString message;
15359  UA_StatusCode retval =
15360  connection->getSendBuffer(connection, connection->localConf.sendBufferSize, &message);
15361  if(retval != UA_STATUSCODE_GOOD)
15362  return retval;
15363 
15364  /* Hide the message beginning where the header will be encoded */
15365  message.data = &message.data[UA_SECURE_MESSAGE_HEADER_LENGTH];
15367 
15368  /* Encode the message type */
15369  size_t messagePos = 0;
15370  UA_NodeId typeId = contentType->typeId; /* always numeric */
15371  typeId.identifier.numeric = contentType->binaryEncodingId;
15372  UA_NodeId_encodeBinary(&typeId, &message, &messagePos);
15373 
15374  /* Encode with the chunking callback */
15375  UA_ChunkInfo ci;
15376  ci.channel = channel;
15377  ci.requestId = requestId;
15378  ci.chunksSoFar = 0;
15379  ci.messageSizeSoFar = 0;
15380  ci.final = false;
15383  if(typeId.identifier.numeric == 446 || typeId.identifier.numeric == 449)
15385  else if(typeId.identifier.numeric == 452 || typeId.identifier.numeric == 455)
15387  retval = UA_encodeBinary(content, contentType,
15388  (UA_exchangeEncodeBuffer)UA_SecureChannel_sendChunk,
15389  &ci, &message, &messagePos);
15390 
15391  /* Encoding failed, release the message */
15392  if(retval != UA_STATUSCODE_GOOD) {
15393  if(!ci.final) {
15394  /* the abort message was not send */
15395  ci.errorCode = retval;
15396  UA_SecureChannel_sendChunk(&ci, &message, messagePos);
15397  }
15398  return retval;
15399  }
15400 
15401  /* Encoding finished, send the final chunk */
15402  ci.final = UA_TRUE;
15403  return UA_SecureChannel_sendChunk(&ci, &message, messagePos);
15404 }
15405 
15406 /***************************/
15407 /* Process Received Chunks */
15408 /***************************/
15409 
15410 static void
15411 UA_SecureChannel_removeChunk(UA_SecureChannel *channel, UA_UInt32 requestId) {
15412  struct ChunkEntry *ch;
15413  LIST_FOREACH(ch, &channel->chunks, pointers) {
15414  if(ch->requestId == requestId) {
15415  UA_ByteString_deleteMembers(&ch->bytes);
15416  LIST_REMOVE(ch, pointers);
15417  UA_free(ch);
15418  return;
15419  }
15420  }
15421 }
15422 
15423 /* assume that chunklength fits */
15424 static void
15425 appendChunk(struct ChunkEntry *ch, const UA_ByteString *msg,
15426  size_t offset, size_t chunklength) {
15427  UA_Byte* new_bytes = UA_realloc(ch->bytes.data, ch->bytes.length + chunklength);
15428  if(!new_bytes) {
15429  UA_ByteString_deleteMembers(&ch->bytes);
15430  return;
15431  }
15432  ch->bytes.data = new_bytes;
15433  memcpy(&ch->bytes.data[ch->bytes.length], &msg->data[offset], chunklength);
15434  ch->bytes.length += chunklength;
15435 }
15436 
15437 static void
15438 UA_SecureChannel_appendChunk(UA_SecureChannel *channel, UA_UInt32 requestId,
15439  const UA_ByteString *msg, size_t offset,
15440  size_t chunklength) {
15441  /* Check if the chunk fits into the message */
15442  if(msg->length - offset < chunklength) {
15443  /* can't process all chunks for that request */
15444  UA_SecureChannel_removeChunk(channel, requestId);
15445  return;
15446  }
15447 
15448  /* Get the chunkentry */
15449  struct ChunkEntry *ch;
15450  LIST_FOREACH(ch, &channel->chunks, pointers) {
15451  if(ch->requestId == requestId)
15452  break;
15453  }
15454 
15455  /* No chunkentry on the channel, create one */
15456  if(!ch) {
15457  ch = UA_malloc(sizeof(struct ChunkEntry));
15458  if(!ch)
15459  return;
15460  ch->requestId = requestId;
15461  UA_ByteString_init(&ch->bytes);
15462  LIST_INSERT_HEAD(&channel->chunks, ch, pointers);
15463  }
15464 
15465  appendChunk(ch, msg, offset, chunklength);
15466 }
15467 
15468 static UA_ByteString
15469 UA_SecureChannel_finalizeChunk(UA_SecureChannel *channel, UA_UInt32 requestId,
15470  const UA_ByteString *msg, size_t offset,
15471  size_t chunklength, UA_Boolean *deleteChunk) {
15472  if(msg->length - offset < chunklength) {
15473  /* can't process all chunks for that request */
15474  UA_SecureChannel_removeChunk(channel, requestId);
15475  return UA_BYTESTRING_NULL;
15476  }
15477 
15478  struct ChunkEntry *ch;
15479  LIST_FOREACH(ch, &channel->chunks, pointers) {
15480  if(ch->requestId == requestId)
15481  break;
15482  }
15483 
15484  UA_ByteString bytes;
15485  if(!ch) {
15486  *deleteChunk = false;
15487  bytes.length = chunklength;
15488  bytes.data = msg->data + offset;
15489  } else {
15490  *deleteChunk = true;
15491  appendChunk(ch, msg, offset, chunklength);
15492  bytes = ch->bytes;
15493  LIST_REMOVE(ch, pointers);
15494  UA_free(ch);
15495  }
15496  return bytes;
15497 }
15498 
15499 static UA_StatusCode
15500 UA_SecureChannel_processSequenceNumber(UA_SecureChannel *channel, UA_UInt32 SequenceNumber) {
15501  /* Does the sequence number match? */
15502  if(SequenceNumber != channel->receiveSequenceNumber + 1) {
15503  if(channel->receiveSequenceNumber + 1 > 4294966271 && SequenceNumber < 1024)
15504  channel->receiveSequenceNumber = SequenceNumber - 1; /* Roll over */
15505  else
15507  }
15508  ++channel->receiveSequenceNumber;
15509  return UA_STATUSCODE_GOOD;
15510 }
15511 
15514  UA_ProcessMessageCallback callback, void *application) {
15516  size_t offset= 0;
15517  do {
15518 
15519  if (chunks->length > 3 && chunks->data[offset] == 'E' &&
15520  chunks->data[offset+1] == 'R' && chunks->data[offset+2] == 'R') {
15521  UA_TcpMessageHeader header;
15522  retval = UA_TcpMessageHeader_decodeBinary(chunks, &offset, &header);
15523  if(retval != UA_STATUSCODE_GOOD)
15524  break;
15525 
15526  UA_TcpErrorMessage errorMessage;
15527  retval = UA_TcpErrorMessage_decodeBinary(chunks, &offset, &errorMessage);
15528  if(retval != UA_STATUSCODE_GOOD)
15529  break;
15530 
15531  callback(application, channel, UA_MESSAGETYPE_ERR, 0, (void*)&errorMessage);
15532  continue;
15533  }
15534 
15535  /* Store the initial offset to compute the header length */
15536  size_t initial_offset = offset;
15537 
15538  /* Decode header */
15540  retval = UA_SecureConversationMessageHeader_decodeBinary(chunks, &offset, &header);
15541  if(retval != UA_STATUSCODE_GOOD)
15542  break;
15543 
15544  /* Is the channel attached to connection? */
15545  if(header.secureChannelId != channel->securityToken.channelId) {
15546  //Service_CloseSecureChannel(server, channel);
15547  //connection->close(connection);
15549  }
15550 
15551  /* Use requestId = 0 with OPN as argument for the callback */
15552  UA_SequenceHeader sequenceHeader;
15553  UA_SequenceHeader_init(&sequenceHeader);
15554 
15555  if((header.messageHeader.messageTypeAndChunkType & 0x00ffffff) != UA_MESSAGETYPE_OPN) {
15556  /* Check the symmetric security header (not for OPN) */
15557  UA_UInt32 tokenId = 0;
15558  retval |= UA_UInt32_decodeBinary(chunks, &offset, &tokenId);
15559  retval |= UA_SequenceHeader_decodeBinary(chunks, &offset, &sequenceHeader);
15560  if(retval != UA_STATUSCODE_GOOD)
15562 
15563  /* Does the token match? */
15564  if(tokenId != channel->securityToken.tokenId) {
15565  if(tokenId != channel->nextSecurityToken.tokenId)
15568  }
15569 
15570  /* Does the sequence number match? */
15571  retval = UA_SecureChannel_processSequenceNumber(channel, sequenceHeader.sequenceNumber);
15572  if(retval != UA_STATUSCODE_GOOD)
15574  }
15575 
15576  /* Process chunk */
15577  size_t processed_header = offset - initial_offset;
15578  switch(header.messageHeader.messageTypeAndChunkType & 0xff000000) {
15580  UA_SecureChannel_appendChunk(channel, sequenceHeader.requestId, chunks, offset,
15581  header.messageHeader.messageSize - processed_header);
15582  break;
15583  case UA_CHUNKTYPE_FINAL: {
15584  UA_Boolean realloced = false;
15585  UA_ByteString message =
15586  UA_SecureChannel_finalizeChunk(channel, sequenceHeader.requestId, chunks, offset,
15587  header.messageHeader.messageSize - processed_header,
15588  &realloced);
15589  if(message.length > 0) {
15590  callback(application, channel, header.messageHeader.messageTypeAndChunkType & 0x00ffffff,
15591  sequenceHeader.requestId, &message);
15592  if(realloced)
15593  UA_ByteString_deleteMembers(&message);
15594  }
15595  break; }
15596  case UA_CHUNKTYPE_ABORT:
15597  UA_SecureChannel_removeChunk(channel, sequenceHeader.requestId);
15598  break;
15599  default:
15601  }
15602 
15603  /* Jump to the end of the chunk */
15604  offset += (header.messageHeader.messageSize - processed_header);
15605  } while(chunks->length > offset);
15606 
15607  return retval;
15608 }
15609 
15610 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/ua_session.c" ***********************************/
15611 
15612 /* This Source Code Form is subject to the terms of the Mozilla Public
15613 * License, v. 2.0. If a copy of the MPL was not distributed with this
15614 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
15615 
15616 #ifdef UA_ENABLE_SUBSCRIPTIONS
15617 #endif
15618 
15619 UA_Session adminSession = {
15620  .clientDescription = {.applicationUri = {0, NULL}, .productUri = {0, NULL},
15621  .applicationName = {.locale = {0, NULL}, .text = {0, NULL}},
15622  .applicationType = UA_APPLICATIONTYPE_CLIENT,
15623  .gatewayServerUri = {0, NULL}, .discoveryProfileUri = {0, NULL},
15624  .discoveryUrlsSize = 0, .discoveryUrls = NULL},
15625  .sessionName = {sizeof("Administrator Session")-1, (UA_Byte*)"Administrator Session"},
15626  .authenticationToken = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC,
15627  .identifier.numeric = 1},
15628  .sessionId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 1},
15629  .maxRequestMessageSize = UA_UINT32_MAX, .maxResponseMessageSize = UA_UINT32_MAX,
15630  .timeout = (UA_Double)UA_INT64_MAX, .validTill = UA_INT64_MAX, .channel = NULL,
15631  .continuationPoints = {NULL}};
15632 
15633 void UA_Session_init(UA_Session *session) {
15634  UA_ApplicationDescription_init(&session->clientDescription);
15635  session->activated = false;
15636  UA_NodeId_init(&session->authenticationToken);
15637  UA_NodeId_init(&session->sessionId);
15638  UA_String_init(&session->sessionName);
15639  session->maxRequestMessageSize = 0;
15640  session->maxResponseMessageSize = 0;
15641  session->timeout = 0;
15642  UA_DateTime_init(&session->validTill);
15643  session->channel = NULL;
15645  LIST_INIT(&session->continuationPoints);
15646 #ifdef UA_ENABLE_SUBSCRIPTIONS
15647  LIST_INIT(&session->serverSubscriptions);
15648  session->lastSubscriptionID = 0;
15649  SIMPLEQ_INIT(&session->responseQueue);
15650 #endif
15651 }
15652 
15653 void UA_Session_deleteMembersCleanup(UA_Session *session, UA_Server* server) {
15654  UA_ApplicationDescription_deleteMembers(&session->clientDescription);
15655  UA_NodeId_deleteMembers(&session->authenticationToken);
15656  UA_NodeId_deleteMembers(&session->sessionId);
15657  UA_String_deleteMembers(&session->sessionName);
15658  struct ContinuationPointEntry *cp, *temp;
15659  LIST_FOREACH_SAFE(cp, &session->continuationPoints, pointers, temp) {
15660  LIST_REMOVE(cp, pointers);
15661  UA_ByteString_deleteMembers(&cp->identifier);
15662  UA_BrowseDescription_deleteMembers(&cp->browseDescription);
15663  UA_free(cp);
15664  }
15665  if(session->channel)
15666  UA_SecureChannel_detachSession(session->channel, session);
15667 #ifdef UA_ENABLE_SUBSCRIPTIONS
15668  UA_Subscription *currents, *temps;
15669  LIST_FOREACH_SAFE(currents, &session->serverSubscriptions, listEntry, temps) {
15670  LIST_REMOVE(currents, listEntry);
15671  UA_Subscription_deleteMembers(currents, server);
15672  UA_free(currents);
15673  }
15674  UA_PublishResponseEntry *entry;
15675  while((entry = SIMPLEQ_FIRST(&session->responseQueue))) {
15676  SIMPLEQ_REMOVE_HEAD(&session->responseQueue, listEntry);
15677  UA_PublishResponse_deleteMembers(&entry->response);
15678  UA_free(entry);
15679  }
15680 #endif
15681 }
15682 
15683 void UA_Session_updateLifetime(UA_Session *session) {
15684  session->validTill = UA_DateTime_nowMonotonic() +
15685  (UA_DateTime)(session->timeout * UA_MSEC_TO_DATETIME);
15686 }
15687 
15688 #ifdef UA_ENABLE_SUBSCRIPTIONS
15689 
15690 void UA_Session_addSubscription(UA_Session *session, UA_Subscription *newSubscription) {
15691  LIST_INSERT_HEAD(&session->serverSubscriptions, newSubscription, listEntry);
15692 }
15693 
15695 UA_Session_deleteSubscription(UA_Server *server, UA_Session *session,
15696  UA_UInt32 subscriptionID) {
15697  UA_Subscription *sub = UA_Session_getSubscriptionByID(session, subscriptionID);
15698  if(!sub)
15700  LIST_REMOVE(sub, listEntry);
15701  UA_Subscription_deleteMembers(sub, server);
15702  UA_free(sub);
15703  return UA_STATUSCODE_GOOD;
15704 }
15705 
15707 UA_Session_getSubscriptionByID(UA_Session *session, UA_UInt32 subscriptionID) {
15708  UA_Subscription *sub;
15709  LIST_FOREACH(sub, &session->serverSubscriptions, listEntry) {
15710  if(sub->subscriptionID == subscriptionID)
15711  break;
15712  }
15713  return sub;
15714 }
15715 
15716 UA_UInt32 UA_Session_getUniqueSubscriptionID(UA_Session *session) {
15717  return ++(session->lastSubscriptionID);
15718 }
15719 
15720 #endif
15721 
15722 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_server.c" ***********************************/
15723 
15724 /* This Source Code Form is subject to the terms of the Mozilla Public
15725 * License, v. 2.0. If a copy of the MPL was not distributed with this
15726 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
15727 
15728 
15729 #ifdef UA_ENABLE_GENERATE_NAMESPACE0
15730 #endif
15731 
15732 #ifdef UA_ENABLE_SUBSCRIPTIONS
15733 #endif
15734 
15735 #if defined(UA_ENABLE_MULTITHREADING) && !defined(NDEBUG)
15736 UA_THREAD_LOCAL bool rcu_locked = false;
15737 #endif
15738 
15739 #if defined(UA_ENABLE_METHODCALLS) && defined(UA_ENABLE_SUBSCRIPTIONS)
15740 UA_THREAD_LOCAL UA_Session* methodCallSession = NULL;
15741 #endif
15742 
15743 static const UA_NodeId nodeIdHasSubType = {
15744  .namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC,
15745  .identifier.numeric = UA_NS0ID_HASSUBTYPE};
15746 static const UA_NodeId nodeIdHasComponent = {
15747  .namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC,
15748  .identifier.numeric = UA_NS0ID_HASCOMPONENT};
15749 static const UA_NodeId nodeIdHasProperty = {
15750  .namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC,
15751  .identifier.numeric = UA_NS0ID_HASPROPERTY};
15752 static const UA_NodeId nodeIdOrganizes = {
15753  .namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC,
15754  .identifier.numeric = UA_NS0ID_ORGANIZES};
15755 
15756 #ifndef UA_ENABLE_GENERATE_NAMESPACE0
15757 static const UA_NodeId nodeIdNonHierarchicalReferences = {
15758  .namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC,
15759  .identifier.numeric = UA_NS0ID_NONHIERARCHICALREFERENCES};
15760 #endif
15761 
15762 /**********************/
15763 /* Namespace Handling */
15764 /**********************/
15765 
15766 UA_UInt16 addNamespace(UA_Server *server, const UA_String name) {
15767  /* Check if the namespace already exists in the server's namespace array */
15768  for(UA_UInt16 i=0;i<server->namespacesSize;++i) {
15769  if(UA_String_equal(&name, &server->namespaces[i]))
15770  return i;
15771  }
15772 
15773  /* Add a new namespace to the namsepace array */
15774  UA_String *newNS = UA_realloc(server->namespaces,
15775  sizeof(UA_String) * (server->namespacesSize + 1));
15776  if(!newNS)
15777  return 0;
15778  server->namespaces = newNS;
15779  UA_StatusCode retval = UA_String_copy(&name, &server->namespaces[server->namespacesSize]);
15780  if(retval != UA_STATUSCODE_GOOD)
15781  return 0;
15782  ++server->namespacesSize;
15783  return (UA_UInt16)(server->namespacesSize - 1);
15784 }
15785 
15786 UA_UInt16 UA_Server_addNamespace(UA_Server *server, const char* name) {
15787  /* Override const attribute to get string (dirty hack) */
15788  const UA_String nameString = {.length = strlen(name),
15789  .data = (UA_Byte*)(uintptr_t)name};
15790  return addNamespace(server, nameString);
15791 }
15792 
15793 
15795 UA_Server_forEachChildNodeCall(UA_Server *server, UA_NodeId parentNodeId,
15796  UA_NodeIteratorCallback callback, void *handle) {
15797  UA_RCU_LOCK();
15798  const UA_Node *parent = UA_NodeStore_get(server->nodestore, &parentNodeId);
15799  if(!parent) {
15800  UA_RCU_UNLOCK();
15802  }
15803 
15804  /* TODO: We need to do an ugly copy of the references array since users may
15805  * delete references from within the callback. In single-threaded mode this
15806  * changes the same node we point at here. In multi-threaded mode, this
15807  * creates a new copy as nodes are truly immutable. */
15808  UA_ReferenceNode *refs = NULL;
15809  size_t refssize = parent->referencesSize;
15810  UA_StatusCode retval = UA_Array_copy(parent->references, parent->referencesSize,
15811  (void**)&refs, &UA_TYPES[UA_TYPES_REFERENCENODE]);
15812  if(retval != UA_STATUSCODE_GOOD) {
15813  UA_RCU_UNLOCK();
15814  return retval;
15815  }
15816 
15817  for(size_t i = parent->referencesSize; i > 0; --i) {
15818  UA_ReferenceNode *ref = &refs[i-1];
15819  retval |= callback(ref->targetId.nodeId, ref->isInverse,
15820  ref->referenceTypeId, handle);
15821  }
15822  UA_RCU_UNLOCK();
15823 
15824  UA_Array_delete(refs, refssize, &UA_TYPES[UA_TYPES_REFERENCENODE]);
15825  return retval;
15826 }
15827 
15828 static UA_AddNodesResult
15829 addNodeInternal(UA_Server *server, UA_Node *node, const UA_NodeId parentNodeId,
15830  const UA_NodeId referenceTypeId) {
15831  UA_AddNodesResult res;
15832  UA_AddNodesResult_init(&res);
15833  UA_RCU_LOCK();
15834  res.statusCode = Service_AddNodes_existing(server, &adminSession, node, &parentNodeId,
15835  &referenceTypeId, &UA_NODEID_NULL,
15836  NULL, &res.addedNodeId);
15837  UA_RCU_UNLOCK();
15838  return res;
15839 }
15840 
15841 static UA_AddNodesResult
15842 addNodeInternalWithType(UA_Server *server, UA_Node *node, const UA_NodeId parentNodeId,
15843  const UA_NodeId referenceTypeId, const UA_NodeId typeIdentifier) {
15844  UA_AddNodesResult res;
15845  UA_AddNodesResult_init(&res);
15846  UA_RCU_LOCK();
15847  res.statusCode = Service_AddNodes_existing(server, &adminSession, node, &parentNodeId,
15848  &referenceTypeId, &typeIdentifier,
15849  NULL, &res.addedNodeId);
15850  UA_RCU_UNLOCK();
15851  return res;
15852 }
15853 
15854 // delete any children of an instance without touching the object itself
15855 static void
15856 deleteInstanceChildren(UA_Server *server, UA_NodeId *objectNodeId) {
15857  /* Browse for children */
15858  UA_BrowseDescription bDes;
15859  UA_BrowseDescription_init(&bDes);
15860  bDes.nodeId = *objectNodeId;
15864  UA_BrowseResult bRes = UA_Server_browse(server, 0, &bDes);
15865 
15866  /* Delete Children */
15867  for(size_t i=0; i<bRes.referencesSize; ++i) {
15868  UA_ReferenceDescription *rd = &bRes.references[i];
15870  UA_Server_deleteNode(server, rd->nodeId.nodeId, true);
15871  } else if (rd->nodeClass == UA_NODECLASS_METHOD) {
15872  UA_Server_deleteReference(server, *objectNodeId, rd->referenceTypeId,
15873  true, rd->nodeId, true);
15874  }
15875  }
15876 
15877  UA_BrowseResult_deleteMembers(&bRes);
15878 }
15879 
15880 /**********/
15881 /* Server */
15882 /**********/
15883 
15884 /* The server needs to be stopped before it can be deleted */
15885 void UA_Server_delete(UA_Server *server) {
15886  // Delete the timed work
15888 
15889  // Delete all internal data
15892  UA_RCU_LOCK();
15893  UA_NodeStore_delete(server->nodestore);
15894  UA_RCU_UNLOCK();
15895  UA_Array_delete(server->namespaces, server->namespacesSize, &UA_TYPES[UA_TYPES_STRING]);
15897  &UA_TYPES[UA_TYPES_ENDPOINTDESCRIPTION]);
15898 
15899 #ifdef UA_ENABLE_MULTITHREADING
15900  pthread_cond_destroy(&server->dispatchQueue_condition);
15901  pthread_mutex_destroy(&server->dispatchQueue_mutex);
15902 #endif
15903  UA_free(server);
15904 }
15905 
15906 /* Recurring cleanup. Removing unused and timed-out channels and sessions */
15907 static void UA_Server_cleanup(UA_Server *server, void *_) {
15908  UA_DateTime nowMonotonic = UA_DateTime_nowMonotonic();
15909  UA_SessionManager_cleanupTimedOut(&server->sessionManager, nowMonotonic);
15911 }
15912 
15913 static UA_StatusCode
15914 readStatus(void *handle, const UA_NodeId nodeid, UA_Boolean sourceTimeStamp,
15915  const UA_NumericRange *range, UA_DataValue *value) {
15916  if(range) {
15917  value->hasStatus = true;
15919  return UA_STATUSCODE_GOOD;
15920  }
15921 
15922  UA_Server *server = (UA_Server*)handle;
15923  UA_ServerStatusDataType *retval = UA_ServerStatusDataType_new();
15924  retval->startTime = server->startTime;
15925  retval->currentTime = UA_DateTime_now();
15926  retval->state = UA_SERVERSTATE_RUNNING;
15927  retval->secondsTillShutdown = 0;
15928  UA_BuildInfo_copy(&server->config.buildInfo, &retval->buildInfo);
15929 
15930  value->value.type = &UA_TYPES[UA_TYPES_SERVERSTATUSDATATYPE];
15931  value->value.arrayLength = 0;
15932  value->value.data = retval;
15933  value->value.arrayDimensionsSize = 0;
15934  value->value.arrayDimensions = NULL;
15935  value->hasValue = true;
15936  if(sourceTimeStamp) {
15937  value->hasSourceTimestamp = true;
15938  value->sourceTimestamp = UA_DateTime_now();
15939  }
15940  return UA_STATUSCODE_GOOD;
15941 }
15942 
15944 static UA_StatusCode
15945 readServiceLevel(void *handle, const UA_NodeId nodeid, UA_Boolean sourceTimeStamp,
15946  const UA_NumericRange *range, UA_DataValue *value) {
15947  if(range) {
15948  value->hasStatus = true;
15950  return UA_STATUSCODE_GOOD;
15951  }
15952 
15953  value->value.type = &UA_TYPES[UA_TYPES_BYTE];
15954  value->value.arrayLength = 0;
15955  UA_Byte *byte = UA_Byte_new();
15956  *byte = 255;
15957  value->value.data = byte;
15958  value->value.arrayDimensionsSize = 0;
15959  value->value.arrayDimensions = NULL;
15960  value->hasValue = true;
15961  if(sourceTimeStamp) {
15962  value->hasSourceTimestamp = true;
15963  value->sourceTimestamp = UA_DateTime_now();
15964  }
15965  return UA_STATUSCODE_GOOD;
15966 }
15967 
15969 static UA_StatusCode
15970 readAuditing(void *handle, const UA_NodeId nodeid, UA_Boolean sourceTimeStamp,
15971  const UA_NumericRange *range, UA_DataValue *value) {
15972  if(range) {
15973  value->hasStatus = true;
15975  return UA_STATUSCODE_GOOD;
15976  }
15977 
15978  value->value.type = &UA_TYPES[UA_TYPES_BOOLEAN];
15979  value->value.arrayLength = 0;
15980  UA_Boolean *boolean = UA_Boolean_new();
15981  *boolean = false;
15982  value->value.data = boolean;
15983  value->value.arrayDimensionsSize = 0;
15984  value->value.arrayDimensions = NULL;
15985  value->hasValue = true;
15986  if(sourceTimeStamp) {
15987  value->hasSourceTimestamp = true;
15988  value->sourceTimestamp = UA_DateTime_now();
15989  }
15990  return UA_STATUSCODE_GOOD;
15991 }
15992 
15993 static UA_StatusCode
15994 readNamespaces(void *handle, const UA_NodeId nodeid, UA_Boolean sourceTimestamp,
15995  const UA_NumericRange *range, UA_DataValue *value) {
15996  if(range) {
15997  value->hasStatus = true;
15999  return UA_STATUSCODE_GOOD;
16000  }
16001  UA_Server *server = (UA_Server*)handle;
16002  UA_StatusCode retval;
16003  retval = UA_Variant_setArrayCopy(&value->value, server->namespaces,
16004  server->namespacesSize, &UA_TYPES[UA_TYPES_STRING]);
16005  if(retval != UA_STATUSCODE_GOOD)
16006  return retval;
16007  value->hasValue = true;
16008  if(sourceTimestamp) {
16009  value->hasSourceTimestamp = true;
16010  value->sourceTimestamp = UA_DateTime_now();
16011  }
16012  return UA_STATUSCODE_GOOD;
16013 }
16014 
16015 static UA_StatusCode
16016 writeNamespaces(void *handle, const UA_NodeId nodeid, const UA_Variant *data,
16017  const UA_NumericRange *range) {
16018  UA_Server *server = (UA_Server*)handle;
16019 
16020  /* Check the data type */
16021  if(data->type != &UA_TYPES[UA_TYPES_STRING])
16023 
16024  /* Check that the variant is not empty */
16025  if(!data->data)
16027 
16028  /* TODO: Writing with a range is not implemented */
16029  if(range)
16031 
16032  UA_String *newNamespaces = data->data;
16033  size_t newNamespacesSize = data->arrayLength;
16034 
16035  /* Test if we append to the existing namespaces */
16036  if(newNamespacesSize <= server->namespacesSize)
16038 
16039  /* Test if the existing namespaces are unchanged */
16040  for(size_t i = 0; i < server->namespacesSize; ++i) {
16041  if(!UA_String_equal(&server->namespaces[i], &newNamespaces[i]))
16043  }
16044 
16045  /* Add namespaces */
16046  for(size_t i = server->namespacesSize; i < newNamespacesSize; ++i)
16047  addNamespace(server, newNamespaces[i]);
16048  return UA_STATUSCODE_GOOD;
16049 }
16050 
16051 static UA_StatusCode
16052 readCurrentTime(void *handle, const UA_NodeId nodeid, UA_Boolean sourceTimeStamp,
16053  const UA_NumericRange *range, UA_DataValue *value) {
16054  if(range) {
16055  value->hasStatus = true;
16057  return UA_STATUSCODE_GOOD;
16058  }
16059  UA_DateTime currentTime = UA_DateTime_now();
16060  UA_StatusCode retval = UA_Variant_setScalarCopy(&value->value, &currentTime,
16061  &UA_TYPES[UA_TYPES_DATETIME]);
16062  if(retval != UA_STATUSCODE_GOOD)
16063  return retval;
16064  value->hasValue = true;
16065  if(sourceTimeStamp) {
16066  value->hasSourceTimestamp = true;
16067  value->sourceTimestamp = currentTime;
16068  }
16069  return UA_STATUSCODE_GOOD;
16070 }
16071 
16072 static void copyNames(UA_Node *node, char *name) {
16073  node->browseName = UA_QUALIFIEDNAME_ALLOC(0, name);
16074  node->displayName = UA_LOCALIZEDTEXT_ALLOC("en_US", name);
16075  node->description = UA_LOCALIZEDTEXT_ALLOC("en_US", name);
16076 }
16077 
16078 static void
16079 addDataTypeNode(UA_Server *server, char* name, UA_UInt32 datatypeid,
16080  UA_Boolean isAbstract, UA_UInt32 parent) {
16082  copyNames((UA_Node*)datatype, name);
16083  datatype->nodeId.identifier.numeric = datatypeid;
16084  datatype->isAbstract = isAbstract;
16085  addNodeInternal(server, (UA_Node*)datatype,
16086  UA_NODEID_NUMERIC(0, parent), nodeIdHasSubType);
16087 }
16088 
16089 static void
16090 addObjectTypeNode(UA_Server *server, char* name, UA_UInt32 objecttypeid,
16091  UA_UInt32 parent, UA_UInt32 parentreference) {
16093  copyNames((UA_Node*)objecttype, name);
16094  objecttype->nodeId.identifier.numeric = objecttypeid;
16095  addNodeInternal(server, (UA_Node*)objecttype, UA_NODEID_NUMERIC(0, parent),
16096  UA_NODEID_NUMERIC(0, parentreference));
16097 }
16098 
16099 static UA_VariableTypeNode*
16100 createVariableTypeNode(UA_Server *server, char* name, UA_UInt32 variabletypeid,
16101  UA_Boolean abstract) {
16103  copyNames((UA_Node*)variabletype, name);
16104  variabletype->nodeId.identifier.numeric = variabletypeid;
16105  variabletype->isAbstract = abstract;
16106  return variabletype;
16107 }
16108 
16109 #if defined(UA_ENABLE_METHODCALLS) && defined(UA_ENABLE_SUBSCRIPTIONS)
16110 static UA_StatusCode
16111 GetMonitoredItems(void *handle, const UA_NodeId objectId, size_t inputSize,
16112  const UA_Variant *input, size_t outputSize, UA_Variant *output) {
16113  UA_UInt32 subscriptionId = *((UA_UInt32*)(input[0].data));
16114  UA_Session* session = methodCallSession;
16115  UA_Subscription* subscription = UA_Session_getSubscriptionByID(session, subscriptionId);
16116  if(!subscription)
16118 
16119  UA_UInt32 sizeOfOutput = 0;
16120  UA_MonitoredItem* monitoredItem;
16121  LIST_FOREACH(monitoredItem, &subscription->monitoredItems, listEntry) {
16122  ++sizeOfOutput;
16123  }
16124  if(sizeOfOutput==0)
16125  return UA_STATUSCODE_GOOD;
16126 
16127  UA_UInt32* clientHandles = UA_Array_new(sizeOfOutput, &UA_TYPES[UA_TYPES_UINT32]);
16128  UA_UInt32* serverHandles = UA_Array_new(sizeOfOutput, &UA_TYPES[UA_TYPES_UINT32]);
16129  UA_UInt32 i = 0;
16130  LIST_FOREACH(monitoredItem, &subscription->monitoredItems, listEntry) {
16131  clientHandles[i] = monitoredItem->clientHandle;
16132  serverHandles[i] = monitoredItem->itemId;
16133  ++i;
16134  }
16135  UA_Variant_setArray(&output[0], clientHandles, sizeOfOutput, &UA_TYPES[UA_TYPES_UINT32]);
16136  UA_Variant_setArray(&output[1], serverHandles, sizeOfOutput, &UA_TYPES[UA_TYPES_UINT32]);
16137  return UA_STATUSCODE_GOOD;
16138 }
16139 #endif
16140 
16141 UA_Server * UA_Server_new(const UA_ServerConfig config) {
16142  UA_Server *server = UA_calloc(1, sizeof(UA_Server));
16143  if(!server)
16144  return NULL;
16145 
16146  server->config = config;
16147  server->nodestore = UA_NodeStore_new();
16148  LIST_INIT(&server->repeatedJobs);
16149 
16150 #ifdef UA_ENABLE_MULTITHREADING
16151  rcu_init();
16152  cds_wfcq_init(&server->dispatchQueue_head, &server->dispatchQueue_tail);
16153  cds_lfs_init(&server->mainLoopJobs);
16154 #else
16155  SLIST_INIT(&server->delayedCallbacks);
16156 #endif
16157 
16158 #ifndef UA_ENABLE_DETERMINISTIC_RNG
16160 #endif
16161 
16162  /* ns0 and ns1 */
16163  server->namespaces = UA_Array_new(2, &UA_TYPES[UA_TYPES_STRING]);
16164  server->namespaces[0] = UA_STRING_ALLOC("http://opcfoundation.org/UA/");
16165  UA_String_copy(&server->config.applicationDescription.applicationUri, &server->namespaces[1]);
16166  server->namespacesSize = 2;
16167 
16168  /* Create endpoints w/o endpointurl. It is added from the networklayers at startup */
16169  server->endpointDescriptions = UA_Array_new(server->config.networkLayersSize,
16170  &UA_TYPES[UA_TYPES_ENDPOINTDESCRIPTION]);
16171  server->endpointDescriptionsSize = server->config.networkLayersSize;
16172  for(size_t i = 0; i < server->config.networkLayersSize; ++i) {
16173  UA_EndpointDescription *endpoint = &server->endpointDescriptions[i];
16175  endpoint->securityPolicyUri =
16176  UA_STRING_ALLOC("http://opcfoundation.org/UA/SecurityPolicy#None");
16177  endpoint->transportProfileUri =
16178  UA_STRING_ALLOC("http://opcfoundation.org/UA-Profile/Transport/uatcp-uasc-uabinary");
16179 
16180  size_t policies = 0;
16181  if(server->config.enableAnonymousLogin)
16182  ++policies;
16183  if(server->config.enableUsernamePasswordLogin)
16184  ++policies;
16185  endpoint->userIdentityTokensSize = policies;
16186  endpoint->userIdentityTokens = UA_Array_new(policies, &UA_TYPES[UA_TYPES_USERTOKENPOLICY]);
16187 
16188  size_t currentIndex = 0;
16189  if(server->config.enableAnonymousLogin) {
16190  UA_UserTokenPolicy_init(&endpoint->userIdentityTokens[currentIndex]);
16191  endpoint->userIdentityTokens[currentIndex].tokenType = UA_USERTOKENTYPE_ANONYMOUS;
16192  endpoint->userIdentityTokens[currentIndex].policyId = UA_STRING_ALLOC(ANONYMOUS_POLICY);
16193  ++currentIndex;
16194  }
16195  if(server->config.enableUsernamePasswordLogin) {
16196  UA_UserTokenPolicy_init(&endpoint->userIdentityTokens[currentIndex]);
16197  endpoint->userIdentityTokens[currentIndex].tokenType = UA_USERTOKENTYPE_USERNAME;
16198  endpoint->userIdentityTokens[currentIndex].policyId = UA_STRING_ALLOC(USERNAME_POLICY);
16199  }
16200 
16201  /* The standard says "the HostName specified in the Server Certificate is the
16202  same as the HostName contained in the endpointUrl provided in the
16203  EndpointDescription */
16204  UA_String_copy(&server->config.serverCertificate, &endpoint->serverCertificate);
16205  UA_ApplicationDescription_copy(&server->config.applicationDescription, &endpoint->server);
16206 
16207  /* copy the discovery url only once the networlayer has been started */
16208  // UA_String_copy(&server->config.networkLayers[i].discoveryUrl, &endpoint->endpointUrl);
16209  }
16210 
16212  UA_SessionManager_init(&server->sessionManager, server);
16213 
16214  UA_Job cleanup = {.type = UA_JOBTYPE_METHODCALL,
16215  .job.methodCall = {.method = UA_Server_cleanup, .data = NULL} };
16216  UA_Server_addRepeatedJob(server, cleanup, 10000, NULL);
16217 
16218  server->startTime = UA_DateTime_now();
16219 
16220 #ifndef UA_ENABLE_GENERATE_NAMESPACE0
16221 
16222  /*********************************/
16223  /* Bootstrap reference hierarchy */
16224  /*********************************/
16225 
16227  copyNames((UA_Node*)references, "References");
16228  references->nodeId.identifier.numeric = UA_NS0ID_REFERENCES;
16229  references->isAbstract = true;
16230  references->symmetric = true;
16231  references->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "References");
16232 
16234  copyNames((UA_Node*)hassubtype, "HasSubtype");
16235  hassubtype->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "HasSupertype");
16236  hassubtype->nodeId.identifier.numeric = UA_NS0ID_HASSUBTYPE;
16237  hassubtype->isAbstract = false;
16238  hassubtype->symmetric = false;
16239 
16240  UA_RCU_LOCK();
16241  UA_NodeStore_insert(server->nodestore, (UA_Node*)references);
16242  UA_NodeStore_insert(server->nodestore, (UA_Node*)hassubtype);
16243  UA_RCU_UNLOCK();
16244 
16245  UA_ReferenceTypeNode *hierarchicalreferences = UA_NodeStore_newReferenceTypeNode();
16246  copyNames((UA_Node*)hierarchicalreferences, "HierarchicalReferences");
16247  hierarchicalreferences->nodeId.identifier.numeric = UA_NS0ID_HIERARCHICALREFERENCES;
16248  hierarchicalreferences->isAbstract = true;
16249  hierarchicalreferences->symmetric = false;
16250  addNodeInternal(server, (UA_Node*)hierarchicalreferences,
16251  UA_NODEID_NUMERIC(0, UA_NS0ID_REFERENCES), nodeIdHasSubType);
16252 
16253  UA_ReferenceTypeNode *nonhierarchicalreferences = UA_NodeStore_newReferenceTypeNode();
16254  copyNames((UA_Node*)nonhierarchicalreferences, "NonHierarchicalReferences");
16255  nonhierarchicalreferences->nodeId.identifier.numeric = UA_NS0ID_NONHIERARCHICALREFERENCES;
16256  nonhierarchicalreferences->isAbstract = true;
16257  nonhierarchicalreferences->symmetric = false;
16258  addNodeInternal(server, (UA_Node*)nonhierarchicalreferences,
16259  UA_NODEID_NUMERIC(0, UA_NS0ID_REFERENCES), nodeIdHasSubType);
16260 
16262  copyNames((UA_Node*)haschild, "HasChild");
16263  haschild->nodeId.identifier.numeric = UA_NS0ID_HASCHILD;
16264  haschild->isAbstract = false;
16265  haschild->symmetric = false;
16266  addNodeInternal(server, (UA_Node*)haschild,
16267  UA_NODEID_NUMERIC(0, UA_NS0ID_HIERARCHICALREFERENCES), nodeIdHasSubType);
16268 
16270  copyNames((UA_Node*)organizes, "Organizes");
16271  organizes->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "OrganizedBy");
16272  organizes->nodeId.identifier.numeric = UA_NS0ID_ORGANIZES;
16273  organizes->isAbstract = false;
16274  organizes->symmetric = false;
16275  addNodeInternal(server, (UA_Node*)organizes,
16276  UA_NODEID_NUMERIC(0, UA_NS0ID_HIERARCHICALREFERENCES), nodeIdHasSubType);
16277 
16279  copyNames((UA_Node*)haseventsource, "HasEventSource");
16280  haseventsource->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "EventSourceOf");
16281  haseventsource->nodeId.identifier.numeric = UA_NS0ID_HASEVENTSOURCE;
16282  haseventsource->isAbstract = false;
16283  haseventsource->symmetric = false;
16284  addNodeInternal(server, (UA_Node*)haseventsource,
16285  UA_NODEID_NUMERIC(0, UA_NS0ID_HIERARCHICALREFERENCES), nodeIdHasSubType);
16286 
16288  copyNames((UA_Node*)hasmodellingrule, "HasModellingRule");
16289  hasmodellingrule->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "ModellingRuleOf");
16290  hasmodellingrule->nodeId.identifier.numeric = UA_NS0ID_HASMODELLINGRULE;
16291  hasmodellingrule->isAbstract = false;
16292  hasmodellingrule->symmetric = false;
16293  addNodeInternal(server, (UA_Node*)hasmodellingrule, nodeIdNonHierarchicalReferences, nodeIdHasSubType);
16294 
16296  copyNames((UA_Node*)hasencoding, "HasEncoding");
16297  hasencoding->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "EncodingOf");
16298  hasencoding->nodeId.identifier.numeric = UA_NS0ID_HASENCODING;
16299  hasencoding->isAbstract = false;
16300  hasencoding->symmetric = false;
16301  addNodeInternal(server, (UA_Node*)hasencoding, nodeIdNonHierarchicalReferences, nodeIdHasSubType);
16302 
16304  copyNames((UA_Node*)hasdescription, "HasDescription");
16305  hasdescription->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "DescriptionOf");
16306  hasdescription->nodeId.identifier.numeric = UA_NS0ID_HASDESCRIPTION;
16307  hasdescription->isAbstract = false;
16308  hasdescription->symmetric = false;
16309  addNodeInternal(server, (UA_Node*)hasdescription, nodeIdNonHierarchicalReferences, nodeIdHasSubType);
16310 
16312  copyNames((UA_Node*)hastypedefinition, "HasTypeDefinition");
16313  hastypedefinition->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "TypeDefinitionOf");
16314  hastypedefinition->nodeId.identifier.numeric = UA_NS0ID_HASTYPEDEFINITION;
16315  hastypedefinition->isAbstract = false;
16316  hastypedefinition->symmetric = false;
16317  addNodeInternal(server, (UA_Node*)hastypedefinition, nodeIdNonHierarchicalReferences, nodeIdHasSubType);
16318 
16320  copyNames((UA_Node*)generatesevent, "GeneratesEvent");
16321  generatesevent->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "GeneratedBy");
16322  generatesevent->nodeId.identifier.numeric = UA_NS0ID_GENERATESEVENT;
16323  generatesevent->isAbstract = false;
16324  generatesevent->symmetric = false;
16325  addNodeInternal(server, (UA_Node*)generatesevent, nodeIdNonHierarchicalReferences, nodeIdHasSubType);
16326 
16328  copyNames((UA_Node*)aggregates, "Aggregates");
16329  aggregates->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "AggregatedBy");
16330  aggregates->nodeId.identifier.numeric = UA_NS0ID_AGGREGATES;
16331  aggregates->isAbstract = false;
16332  aggregates->symmetric = false;
16333  addNodeInternal(server, (UA_Node*)aggregates, UA_NODEID_NUMERIC(0, UA_NS0ID_HASCHILD), nodeIdHasSubType);
16334 
16335  /* complete bootstrap of hassubtype */
16336  UA_Server_addReference(server, UA_NODEID_NUMERIC(0, UA_NS0ID_HASCHILD), nodeIdHasSubType,
16337  UA_EXPANDEDNODEID_NUMERIC(0, UA_NS0ID_HASSUBTYPE), true);
16338 
16340  copyNames((UA_Node*)hasproperty, "HasProperty");
16341  hasproperty->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "PropertyOf");
16342  hasproperty->nodeId.identifier.numeric = UA_NS0ID_HASPROPERTY;
16343  hasproperty->isAbstract = false;
16344  hasproperty->symmetric = false;
16345  addNodeInternal(server, (UA_Node*)hasproperty,
16346  UA_NODEID_NUMERIC(0, UA_NS0ID_AGGREGATES), nodeIdHasSubType);
16347 
16349  copyNames((UA_Node*)hascomponent, "HasComponent");
16350  hascomponent->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "ComponentOf");
16351  hascomponent->nodeId.identifier.numeric = UA_NS0ID_HASCOMPONENT;
16352  hascomponent->isAbstract = false;
16353  hascomponent->symmetric = false;
16354  addNodeInternal(server, (UA_Node*)hascomponent, UA_NODEID_NUMERIC(0, UA_NS0ID_AGGREGATES), nodeIdHasSubType);
16355 
16357  copyNames((UA_Node*)hasnotifier, "HasNotifier");
16358  hasnotifier->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "NotifierOf");
16359  hasnotifier->nodeId.identifier.numeric = UA_NS0ID_HASNOTIFIER;
16360  hasnotifier->isAbstract = false;
16361  hasnotifier->symmetric = false;
16362  addNodeInternal(server, (UA_Node*)hasnotifier, UA_NODEID_NUMERIC(0, UA_NS0ID_HASEVENTSOURCE), nodeIdHasSubType);
16363 
16365  copyNames((UA_Node*)hasorderedcomponent, "HasOrderedComponent");
16366  hasorderedcomponent->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "OrderedComponentOf");
16367  hasorderedcomponent->nodeId.identifier.numeric = UA_NS0ID_HASORDEREDCOMPONENT;
16368  hasorderedcomponent->isAbstract = false;
16369  hasorderedcomponent->symmetric = false;
16370  addNodeInternal(server, (UA_Node*)hasorderedcomponent, UA_NODEID_NUMERIC(0, UA_NS0ID_HASCOMPONENT), nodeIdHasSubType);
16371 
16373  copyNames((UA_Node*)hasmodelparent, "HasModelParent");
16374  hasmodelparent->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "ModelParentOf");
16375  hasmodelparent->nodeId.identifier.numeric = UA_NS0ID_HASMODELPARENT;
16376  hasmodelparent->isAbstract = false;
16377  hasmodelparent->symmetric = false;
16378  addNodeInternal(server, (UA_Node*)hasmodelparent, nodeIdNonHierarchicalReferences, nodeIdHasSubType);
16379 
16381  copyNames((UA_Node*)fromstate, "FromState");
16382  fromstate->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "ToTransition");
16383  fromstate->nodeId.identifier.numeric = UA_NS0ID_FROMSTATE;
16384  fromstate->isAbstract = false;
16385  fromstate->symmetric = false;
16386  addNodeInternal(server, (UA_Node*)fromstate, nodeIdNonHierarchicalReferences, nodeIdHasSubType);
16387 
16389  copyNames((UA_Node*)tostate, "ToState");
16390  tostate->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "FromTransition");
16391  tostate->nodeId.identifier.numeric = UA_NS0ID_TOSTATE;
16392  tostate->isAbstract = false;
16393  tostate->symmetric = false;
16394  addNodeInternal(server, (UA_Node*)tostate, nodeIdNonHierarchicalReferences, nodeIdHasSubType);
16395 
16397  copyNames((UA_Node*)hascause, "HasCause");
16398  hascause->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "MayBeCausedBy");
16399  hascause->nodeId.identifier.numeric = UA_NS0ID_HASCAUSE;
16400  hascause->isAbstract = false;
16401  hascause->symmetric = false;
16402  addNodeInternal(server, (UA_Node*)hascause, nodeIdNonHierarchicalReferences, nodeIdHasSubType);
16403 
16405  copyNames((UA_Node*)haseffect, "HasEffect");
16406  haseffect->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "MayBeEffectedBy");
16407  haseffect->nodeId.identifier.numeric = UA_NS0ID_HASEFFECT;
16408  haseffect->isAbstract = false;
16409  haseffect->symmetric = false;
16410  addNodeInternal(server, (UA_Node*)haseffect, nodeIdNonHierarchicalReferences, nodeIdHasSubType);
16411 
16412  UA_ReferenceTypeNode *hashistoricalconfiguration = UA_NodeStore_newReferenceTypeNode();
16413  copyNames((UA_Node*)hashistoricalconfiguration, "HasHistoricalConfiguration");
16414  hashistoricalconfiguration->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "HistoricalConfigurationOf");
16415  hashistoricalconfiguration->nodeId.identifier.numeric = UA_NS0ID_HASHISTORICALCONFIGURATION;
16416  hashistoricalconfiguration->isAbstract = false;
16417  hashistoricalconfiguration->symmetric = false;
16418  addNodeInternal(server, (UA_Node*)hashistoricalconfiguration, UA_NODEID_NUMERIC(0, UA_NS0ID_AGGREGATES), nodeIdHasSubType);
16419 
16420  /**************/
16421  /* Data Types */
16422  /**************/
16423 
16425  copyNames((UA_Node*)basedatatype, "BaseDataType");
16426  basedatatype->nodeId.identifier.numeric = UA_NS0ID_BASEDATATYPE;
16427  basedatatype->isAbstract = true;
16428  UA_RCU_LOCK();
16429  UA_NodeStore_insert(server->nodestore, (UA_Node*)basedatatype);
16430  UA_RCU_UNLOCK();
16431 
16432  addDataTypeNode(server, "Boolean", UA_NS0ID_BOOLEAN, false, UA_NS0ID_BASEDATATYPE);
16433  addDataTypeNode(server, "Number", UA_NS0ID_NUMBER, true, UA_NS0ID_BASEDATATYPE);
16434  addDataTypeNode(server, "Float", UA_NS0ID_FLOAT, false, UA_NS0ID_NUMBER);
16435  addDataTypeNode(server, "Double", UA_NS0ID_DOUBLE, false, UA_NS0ID_NUMBER);
16436  addDataTypeNode(server, "Integer", UA_NS0ID_INTEGER, true, UA_NS0ID_NUMBER);
16437  addDataTypeNode(server, "SByte", UA_NS0ID_SBYTE, false, UA_NS0ID_INTEGER);
16438  addDataTypeNode(server, "Int16", UA_NS0ID_INT16, false, UA_NS0ID_INTEGER);
16439  addDataTypeNode(server, "Int32", UA_NS0ID_INT32, false, UA_NS0ID_INTEGER);
16440  addDataTypeNode(server, "Int64", UA_NS0ID_INT64, false, UA_NS0ID_INTEGER);
16441  addDataTypeNode(server, "UInteger", UA_NS0ID_UINTEGER, true, UA_NS0ID_INTEGER);
16442  addDataTypeNode(server, "Byte", UA_NS0ID_BYTE, false, UA_NS0ID_UINTEGER);
16443  addDataTypeNode(server, "UInt16", UA_NS0ID_UINT16, false, UA_NS0ID_UINTEGER);
16444  addDataTypeNode(server, "UInt32", UA_NS0ID_UINT32, false, UA_NS0ID_UINTEGER);
16445  addDataTypeNode(server, "UInt64", UA_NS0ID_UINT64, false, UA_NS0ID_UINTEGER);
16446  addDataTypeNode(server, "String", UA_NS0ID_STRING, false, UA_NS0ID_BASEDATATYPE);
16447  addDataTypeNode(server, "DateTime", UA_NS0ID_DATETIME, false, UA_NS0ID_BASEDATATYPE);
16448  addDataTypeNode(server, "Guid", UA_NS0ID_GUID, false, UA_NS0ID_BASEDATATYPE);
16449  addDataTypeNode(server, "ByteString", UA_NS0ID_BYTESTRING, false, UA_NS0ID_BASEDATATYPE);
16450  addDataTypeNode(server, "XmlElement", UA_NS0ID_XMLELEMENT, false, UA_NS0ID_BASEDATATYPE);
16451  addDataTypeNode(server, "NodeId", UA_NS0ID_NODEID, false, UA_NS0ID_BASEDATATYPE);
16452  addDataTypeNode(server, "ExpandedNodeId", UA_NS0ID_EXPANDEDNODEID, false, UA_NS0ID_BASEDATATYPE);
16453  addDataTypeNode(server, "StatusCode", UA_NS0ID_STATUSCODE, false, UA_NS0ID_BASEDATATYPE);
16454  addDataTypeNode(server, "QualifiedName", UA_NS0ID_QUALIFIEDNAME, false, UA_NS0ID_BASEDATATYPE);
16455  addDataTypeNode(server, "LocalizedText", UA_NS0ID_LOCALIZEDTEXT, false, UA_NS0ID_BASEDATATYPE);
16456  addDataTypeNode(server, "Structure", UA_NS0ID_STRUCTURE, true, UA_NS0ID_BASEDATATYPE);
16457  addDataTypeNode(server, "ServerStatusDataType", UA_NS0ID_SERVERSTATUSDATATYPE, false, UA_NS0ID_STRUCTURE);
16458  addDataTypeNode(server, "BuildInfo", UA_NS0ID_BUILDINFO, false, UA_NS0ID_STRUCTURE);
16459  addDataTypeNode(server, "DataValue", UA_NS0ID_DATAVALUE, false, UA_NS0ID_BASEDATATYPE);
16460  addDataTypeNode(server, "DiagnosticInfo", UA_NS0ID_DIAGNOSTICINFO, false, UA_NS0ID_BASEDATATYPE);
16461  addDataTypeNode(server, "Enumeration", UA_NS0ID_ENUMERATION, true, UA_NS0ID_BASEDATATYPE);
16462  addDataTypeNode(server, "ServerState", UA_NS0ID_SERVERSTATE, false, UA_NS0ID_ENUMERATION);
16463 
16464  /*****************/
16465  /* VariableTypes */
16466  /*****************/
16467 
16468  UA_VariableTypeNode *basevartype =
16469  createVariableTypeNode(server, "BaseVariableType", UA_NS0ID_BASEVARIABLETYPE, true);
16470  basevartype->valueRank = -2;
16471  basevartype->dataType = UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATATYPE);
16472  UA_RCU_LOCK();
16473  UA_NodeStore_insert(server->nodestore, (UA_Node*)basevartype);
16474  UA_RCU_UNLOCK();
16475 
16476  UA_VariableTypeNode *basedatavartype =
16477  createVariableTypeNode(server, "BaseDataVariableType", UA_NS0ID_BASEDATAVARIABLETYPE, false);
16478  basedatavartype->valueRank = -2;
16479  basedatavartype->dataType = UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATATYPE);
16480  addNodeInternalWithType(server, (UA_Node*)basedatavartype,
16481  UA_NODEID_NUMERIC(0, UA_NS0ID_BASEVARIABLETYPE),
16482  nodeIdHasSubType, UA_NODEID_NUMERIC(0, UA_NS0ID_BASEVARIABLETYPE));
16483 
16484  UA_VariableTypeNode *propertytype =
16485  createVariableTypeNode(server, "PropertyType", UA_NS0ID_PROPERTYTYPE, false);
16486  propertytype->valueRank = -2;
16487  propertytype->dataType = UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATATYPE);
16488  addNodeInternalWithType(server, (UA_Node*)propertytype,
16489  UA_NODEID_NUMERIC(0, UA_NS0ID_BASEVARIABLETYPE),
16490  nodeIdHasSubType, UA_NODEID_NUMERIC(0, UA_NS0ID_BASEVARIABLETYPE));
16491 
16492  UA_VariableTypeNode *buildinfotype =
16493  createVariableTypeNode(server, "BuildInfoType", UA_NS0ID_BUILDINFOTYPE, false);
16494  buildinfotype->valueRank = -1;
16495  buildinfotype->dataType = UA_NODEID_NUMERIC(0, UA_NS0ID_BUILDINFO);
16496  addNodeInternalWithType(server, (UA_Node*)buildinfotype,
16497  UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE),
16498  nodeIdHasSubType, UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE));
16499 
16500  UA_VariableTypeNode *serverstatustype =
16501  createVariableTypeNode(server, "ServerStatusType", UA_NS0ID_SERVERSTATUSTYPE, false);
16502  serverstatustype->valueRank = -1;
16503  serverstatustype->dataType = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVERSTATUSDATATYPE);
16504  addNodeInternalWithType(server, (UA_Node*)serverstatustype,
16505  UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE),
16506  nodeIdHasSubType, UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE));
16507 
16508  /**********************/
16509  /* Basic Object Types */
16510  /**********************/
16511 
16513  copyNames((UA_Node*)baseobjtype, "BaseObjectType");
16514  baseobjtype->nodeId.identifier.numeric = UA_NS0ID_BASEOBJECTTYPE;
16515  UA_RCU_LOCK();
16516  UA_NodeStore_insert(server->nodestore, (UA_Node*)baseobjtype);
16517  UA_RCU_UNLOCK();
16518 
16519  addObjectTypeNode(server, "ModellingRuleType", UA_NS0ID_MODELLINGRULETYPE,
16521  addObjectTypeNode(server, "FolderType", UA_NS0ID_FOLDERTYPE,
16523  addObjectTypeNode(server, "ServerType", UA_NS0ID_SERVERTYPE,
16525  addObjectTypeNode(server, "ServerDiagnosticsType", UA_NS0ID_SERVERDIAGNOSTICSTYPE,
16527  addObjectTypeNode(server, "ServerCapatilitiesType", UA_NS0ID_SERVERCAPABILITIESTYPE,
16529 
16530  /******************/
16531  /* Root and below */
16532  /******************/
16533 
16534  static const UA_NodeId nodeIdFolderType = {
16535  .namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC,
16536  .identifier.numeric = UA_NS0ID_FOLDERTYPE};
16537  static const UA_NodeId nodeIdHasTypeDefinition = {
16538  .namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC,
16539  .identifier.numeric = UA_NS0ID_HASTYPEDEFINITION};
16540 
16542  copyNames((UA_Node*)root, "Root");
16543  root->nodeId.identifier.numeric = UA_NS0ID_ROOTFOLDER;
16544  UA_RCU_LOCK();
16545  UA_NodeStore_insert(server->nodestore, (UA_Node*)root);
16546  UA_RCU_UNLOCK();
16547  UA_Server_addReference(server, UA_NODEID_NUMERIC(0, UA_NS0ID_ROOTFOLDER), nodeIdHasTypeDefinition,
16548  UA_EXPANDEDNODEID_NUMERIC(0, UA_NS0ID_FOLDERTYPE), true);
16549 
16551  copyNames((UA_Node*)objects, "Objects");
16552  objects->nodeId.identifier.numeric = UA_NS0ID_OBJECTSFOLDER;
16553  addNodeInternalWithType(server, (UA_Node*)objects, UA_NODEID_NUMERIC(0, UA_NS0ID_ROOTFOLDER),
16554  nodeIdOrganizes, nodeIdFolderType);
16555 
16557  copyNames((UA_Node*)types, "Types");
16558  types->nodeId.identifier.numeric = UA_NS0ID_TYPESFOLDER;
16559  addNodeInternalWithType(server, (UA_Node*)types, UA_NODEID_NUMERIC(0, UA_NS0ID_ROOTFOLDER),
16560  nodeIdOrganizes, nodeIdFolderType);
16561 
16562  UA_ObjectNode *referencetypes = UA_NodeStore_newObjectNode();
16563  copyNames((UA_Node*)referencetypes, "ReferenceTypes");
16564  referencetypes->nodeId.identifier.numeric = UA_NS0ID_REFERENCETYPESFOLDER;
16565  addNodeInternalWithType(server, (UA_Node*)referencetypes, UA_NODEID_NUMERIC(0, UA_NS0ID_TYPESFOLDER),
16566  nodeIdOrganizes, nodeIdFolderType);
16567  UA_Server_addReference(server, UA_NODEID_NUMERIC(0, UA_NS0ID_REFERENCETYPESFOLDER), nodeIdOrganizes,
16568  UA_EXPANDEDNODEID_NUMERIC(0, UA_NS0ID_REFERENCES), true);
16569 
16571  copyNames((UA_Node*)datatypes, "DataTypes");
16572  datatypes->nodeId.identifier.numeric = UA_NS0ID_DATATYPESFOLDER;
16573  addNodeInternalWithType(server, (UA_Node*)datatypes, UA_NODEID_NUMERIC(0, UA_NS0ID_TYPESFOLDER),
16574  nodeIdOrganizes, nodeIdFolderType);
16575  UA_Server_addReference(server, UA_NODEID_NUMERIC(0, UA_NS0ID_DATATYPESFOLDER), nodeIdOrganizes,
16576  UA_EXPANDEDNODEID_NUMERIC(0, UA_NS0ID_BASEDATATYPE), true);
16577 
16578  UA_ObjectNode *variabletypes = UA_NodeStore_newObjectNode();
16579  copyNames((UA_Node*)variabletypes, "VariableTypes");
16580  variabletypes->nodeId.identifier.numeric = UA_NS0ID_VARIABLETYPESFOLDER;
16581  addNodeInternalWithType(server, (UA_Node*)variabletypes, UA_NODEID_NUMERIC(0, UA_NS0ID_TYPESFOLDER),
16582  nodeIdOrganizes, nodeIdFolderType);
16583  UA_Server_addReference(server, UA_NODEID_NUMERIC(0, UA_NS0ID_VARIABLETYPESFOLDER), nodeIdOrganizes,
16584  UA_EXPANDEDNODEID_NUMERIC(0, UA_NS0ID_BASEVARIABLETYPE), true);
16585 
16586  UA_ObjectNode *objecttypes = UA_NodeStore_newObjectNode();
16587  copyNames((UA_Node*)objecttypes, "ObjectTypes");
16588  objecttypes->nodeId.identifier.numeric = UA_NS0ID_OBJECTTYPESFOLDER;
16589  addNodeInternalWithType(server, (UA_Node*)objecttypes, UA_NODEID_NUMERIC(0, UA_NS0ID_TYPESFOLDER),
16590  nodeIdOrganizes, nodeIdFolderType);
16591  UA_Server_addReference(server, UA_NODEID_NUMERIC(0, UA_NS0ID_OBJECTTYPESFOLDER), nodeIdOrganizes,
16592  UA_EXPANDEDNODEID_NUMERIC(0, UA_NS0ID_BASEOBJECTTYPE), true);
16593 
16594  UA_ObjectNode *eventtypes = UA_NodeStore_newObjectNode();
16595  copyNames((UA_Node*)eventtypes, "EventTypes");
16596  eventtypes->nodeId.identifier.numeric = UA_NS0ID_EVENTTYPESFOLDER;
16597  addNodeInternalWithType(server, (UA_Node*)eventtypes, UA_NODEID_NUMERIC(0, UA_NS0ID_TYPESFOLDER),
16598  nodeIdOrganizes, nodeIdFolderType);
16599 
16601  copyNames((UA_Node*)views, "Views");
16602  views->nodeId.identifier.numeric = UA_NS0ID_VIEWSFOLDER;
16603  addNodeInternalWithType(server, (UA_Node*)views, UA_NODEID_NUMERIC(0, UA_NS0ID_ROOTFOLDER),
16604  nodeIdOrganizes, nodeIdFolderType);
16605 
16606  /*******************/
16607  /* Modelling Rules */
16608  /*******************/
16609 
16611  copyNames((UA_Node*)mandatory, "Mandatory");
16612  mandatory->nodeId.identifier.numeric = UA_NS0ID_MODELLINGRULE_MANDATORY;
16613  addNodeInternalWithType(server, (UA_Node*)mandatory, UA_NODEID_NULL,
16614  UA_NODEID_NULL, UA_NODEID_NUMERIC(0, UA_NS0ID_MODELLINGRULETYPE));
16615 
16617  copyNames((UA_Node*)optional, "Optional");
16618  optional->nodeId.identifier.numeric = UA_NS0ID_MODELLINGRULE_OPTIONAL;
16619  addNodeInternalWithType(server, (UA_Node*)optional, UA_NODEID_NULL,
16620  UA_NODEID_NULL, UA_NODEID_NUMERIC(0, UA_NS0ID_MODELLINGRULETYPE));
16621 
16622 #else
16623  /* load the generated namespace externally */
16624  ua_namespaceinit_generated(server);
16625 #endif
16626 
16627  /*********************/
16628  /* The Server Object */
16629  /*********************/
16630 
16631  /* Create our own server object */
16632  UA_ObjectNode *servernode = UA_NodeStore_newObjectNode();
16633  copyNames((UA_Node*)servernode, "Server");
16634  servernode->nodeId.identifier.numeric = UA_NS0ID_SERVER;
16635  addNodeInternalWithType(server, (UA_Node*)servernode, UA_NODEID_NUMERIC(0, UA_NS0ID_OBJECTSFOLDER),
16636  nodeIdOrganizes, UA_NODEID_NUMERIC(0, UA_NS0ID_SERVERTYPE));
16637 
16638  // If we are in an UA conformant namespace, the above function just created a full ServerType object.
16639  // Before readding every variable, delete whatever got instantiated.
16640  // here we can't reuse servernode->nodeId because it may be deleted in addNodeInternalWithType if the node could not be added
16641  UA_NodeId serverNodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER);
16642  deleteInstanceChildren(server, &serverNodeId);
16643 
16644  UA_VariableNode *namespaceArray = UA_NodeStore_newVariableNode();
16645  copyNames((UA_Node*)namespaceArray, "NamespaceArray");
16646  namespaceArray->nodeId.identifier.numeric = UA_NS0ID_SERVER_NAMESPACEARRAY;
16647  namespaceArray->valueSource = UA_VALUESOURCE_DATASOURCE;
16648  namespaceArray->value.dataSource = (UA_DataSource) {.handle = server, .read = readNamespaces,
16649  .write = writeNamespaces};
16650  namespaceArray->dataType = UA_TYPES[UA_TYPES_STRING].typeId;
16651  namespaceArray->valueRank = 1;
16652  namespaceArray->minimumSamplingInterval = 1.0;
16653  addNodeInternalWithType(server, (UA_Node*)namespaceArray, UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER),
16654  nodeIdHasProperty, UA_NODEID_NUMERIC(0, UA_NS0ID_PROPERTYTYPE));
16655 
16656  UA_VariableNode *serverArray = UA_NodeStore_newVariableNode();
16657  copyNames((UA_Node*)serverArray, "ServerArray");
16658  serverArray->nodeId.identifier.numeric = UA_NS0ID_SERVER_SERVERARRAY;
16659  UA_Variant_setArrayCopy(&serverArray->value.data.value.value,
16660  &server->config.applicationDescription.applicationUri, 1,
16661  &UA_TYPES[UA_TYPES_STRING]);
16662  serverArray->value.data.value.hasValue = true;
16663  serverArray->valueRank = 1;
16664  serverArray->minimumSamplingInterval = 1.0;
16665  addNodeInternalWithType(server, (UA_Node*)serverArray, UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER),
16666  nodeIdHasProperty, UA_NODEID_NUMERIC(0, UA_NS0ID_PROPERTYTYPE));
16667 
16668  UA_ObjectNode *servercapablities = UA_NodeStore_newObjectNode();
16669  copyNames((UA_Node*)servercapablities, "ServerCapabilities");
16670  servercapablities->nodeId.identifier.numeric = UA_NS0ID_SERVER_SERVERCAPABILITIES;
16671  addNodeInternalWithType(server, (UA_Node*)servercapablities, UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER),
16672  nodeIdHasComponent,
16673  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVERCAPABILITIESTYPE));
16674  UA_NodeId ServerCapabilitiesNodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERCAPABILITIES);
16675  deleteInstanceChildren(server, &ServerCapabilitiesNodeId);
16676 
16677  UA_VariableNode *localeIdArray = UA_NodeStore_newVariableNode();
16678  copyNames((UA_Node*)localeIdArray, "LocaleIdArray");
16679  localeIdArray->nodeId.identifier.numeric = UA_NS0ID_SERVER_SERVERCAPABILITIES_LOCALEIDARRAY;
16680  UA_String enLocale = UA_STRING("en");
16681  UA_Variant_setArrayCopy(&localeIdArray->value.data.value.value,
16682  &enLocale, 1, &UA_TYPES[UA_TYPES_STRING]);
16683  localeIdArray->value.data.value.hasValue = true;
16684  localeIdArray->valueRank = 1;
16685  localeIdArray->minimumSamplingInterval = 1.0;
16686  addNodeInternalWithType(server, (UA_Node*)localeIdArray,
16687  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERCAPABILITIES),
16688  nodeIdHasProperty, UA_NODEID_NUMERIC(0, UA_NS0ID_PROPERTYTYPE));
16689 
16690  UA_VariableNode *maxBrowseContinuationPoints = UA_NodeStore_newVariableNode();
16691  copyNames((UA_Node*)maxBrowseContinuationPoints, "MaxBrowseContinuationPoints");
16692  maxBrowseContinuationPoints->nodeId.identifier.numeric =
16694  UA_Variant_setScalar(&maxBrowseContinuationPoints->value.data.value.value,
16695  UA_UInt16_new(), &UA_TYPES[UA_TYPES_UINT16]);
16696  maxBrowseContinuationPoints->value.data.value.hasValue = true;
16697  addNodeInternalWithType(server, (UA_Node*)maxBrowseContinuationPoints,
16698  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERCAPABILITIES),
16699  nodeIdHasProperty, UA_NODEID_NUMERIC(0, UA_NS0ID_PROPERTYTYPE));
16700 
16702 #define MAX_PROFILEARRAY 16 //a *magic* limit to the number of supported profiles
16703 #define ADDPROFILEARRAY(x) profileArray[profileArraySize++] = UA_STRING_ALLOC(x)
16704  UA_String profileArray[MAX_PROFILEARRAY];
16705  UA_UInt16 profileArraySize = 0;
16706  ADDPROFILEARRAY("http://opcfoundation.org/UA-Profile/Server/NanoEmbeddedDevice");
16707 
16708 #ifdef UA_ENABLE_SERVICESET_NODEMANAGEMENT
16709  ADDPROFILEARRAY("http://opcfoundation.org/UA-Profile/Server/NodeManagement");
16710 #endif
16711 #ifdef UA_ENABLE_SERVICESET_METHOD
16712  ADDPROFILEARRAY("http://opcfoundation.org/UA-Profile/Server/Methods");
16713 #endif
16714 #ifdef UA_ENABLE_SUBSCRIPTIONS
16715  ADDPROFILEARRAY("http://opcfoundation.org/UA-Profile/Server/EmbeddedDataChangeSubscription");
16716 #endif
16717 
16718  UA_VariableNode *serverProfileArray = UA_NodeStore_newVariableNode();
16719  copyNames((UA_Node*)serverProfileArray, "ServerProfileArray");
16720  serverProfileArray->nodeId.identifier.numeric = UA_NS0ID_SERVER_SERVERCAPABILITIES_SERVERPROFILEARRAY;
16721  UA_Variant_setArray(&serverProfileArray->value.data.value.value,
16722  UA_Array_new(profileArraySize, &UA_TYPES[UA_TYPES_STRING]),
16723  profileArraySize, &UA_TYPES[UA_TYPES_STRING]);
16724  for(UA_UInt16 i=0;i<profileArraySize;++i)
16725  ((UA_String *)serverProfileArray->value.data.value.value.data)[i] = profileArray[i];
16726  serverProfileArray->value.data.value.hasValue = true;
16727  serverProfileArray->valueRank = 1;
16728  serverProfileArray->minimumSamplingInterval = 1.0;
16729  addNodeInternalWithType(server, (UA_Node*)serverProfileArray,
16730  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERCAPABILITIES),
16731  nodeIdHasProperty, UA_NODEID_NUMERIC(0, UA_NS0ID_PROPERTYTYPE));
16732 
16733  UA_VariableNode *softwareCertificates = UA_NodeStore_newVariableNode();
16734  copyNames((UA_Node*)softwareCertificates, "SoftwareCertificates");
16735  softwareCertificates->nodeId.identifier.numeric = UA_NS0ID_SERVER_SERVERCAPABILITIES_SOFTWARECERTIFICATES;
16736  softwareCertificates->dataType = UA_TYPES[UA_TYPES_SIGNEDSOFTWARECERTIFICATE].typeId;
16737  addNodeInternalWithType(server, (UA_Node*)softwareCertificates,
16738  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERCAPABILITIES),
16739  nodeIdHasProperty, UA_NODEID_NUMERIC(0, UA_NS0ID_PROPERTYTYPE));
16740 
16741  UA_VariableNode *maxQueryContinuationPoints = UA_NodeStore_newVariableNode();
16742  copyNames((UA_Node*)maxQueryContinuationPoints, "MaxQueryContinuationPoints");
16743  maxQueryContinuationPoints->nodeId.identifier.numeric = UA_NS0ID_SERVER_SERVERCAPABILITIES_MAXQUERYCONTINUATIONPOINTS;
16744  UA_Variant_setScalar(&maxQueryContinuationPoints->value.data.value.value,
16745  UA_UInt16_new(), &UA_TYPES[UA_TYPES_UINT16]);
16746  maxQueryContinuationPoints->value.data.value.hasValue = true;
16747  addNodeInternalWithType(server, (UA_Node*)maxQueryContinuationPoints,
16748  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERCAPABILITIES),
16749  nodeIdHasProperty, UA_NODEID_NUMERIC(0, UA_NS0ID_PROPERTYTYPE));
16750 
16751  UA_VariableNode *maxHistoryContinuationPoints = UA_NodeStore_newVariableNode();
16752  copyNames((UA_Node*)maxHistoryContinuationPoints, "MaxHistoryContinuationPoints");
16753  maxHistoryContinuationPoints->nodeId.identifier.numeric = UA_NS0ID_SERVER_SERVERCAPABILITIES_MAXHISTORYCONTINUATIONPOINTS;
16754  UA_Variant_setScalar(&maxHistoryContinuationPoints->value.data.value.value,
16755  UA_UInt16_new(), &UA_TYPES[UA_TYPES_UINT16]);
16756  maxHistoryContinuationPoints->value.data.value.hasValue = true;
16757  addNodeInternalWithType(server, (UA_Node*)maxHistoryContinuationPoints,
16758  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERCAPABILITIES),
16759  nodeIdHasProperty, UA_NODEID_NUMERIC(0, UA_NS0ID_PROPERTYTYPE));
16760 
16761  UA_VariableNode *minSupportedSampleRate = UA_NodeStore_newVariableNode();
16762  copyNames((UA_Node*)minSupportedSampleRate, "MinSupportedSampleRate");
16763  minSupportedSampleRate->nodeId.identifier.numeric = UA_NS0ID_SERVER_SERVERCAPABILITIES_MINSUPPORTEDSAMPLERATE;
16764  UA_Variant_setScalar(&minSupportedSampleRate->value.data.value.value,
16765  UA_Double_new(), &UA_TYPES[UA_TYPES_DOUBLE]);
16766  minSupportedSampleRate->value.data.value.hasValue = true;
16767  addNodeInternalWithType(server, (UA_Node*)minSupportedSampleRate,
16768  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERCAPABILITIES),
16769  nodeIdHasProperty, UA_NODEID_NUMERIC(0, UA_NS0ID_PROPERTYTYPE));
16770 
16771  UA_ObjectNode *modellingRules = UA_NodeStore_newObjectNode();
16772  copyNames((UA_Node*)modellingRules, "ModellingRules");
16773  modellingRules->nodeId.identifier.numeric = UA_NS0ID_SERVER_SERVERCAPABILITIES_MODELLINGRULES;
16774  addNodeInternalWithType(server, (UA_Node*)modellingRules,
16775  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERCAPABILITIES), nodeIdHasProperty,
16776  UA_NODEID_NUMERIC(0, UA_NS0ID_FOLDERTYPE));
16777 
16778  UA_ObjectNode *aggregateFunctions = UA_NodeStore_newObjectNode();
16779  copyNames((UA_Node*)aggregateFunctions, "AggregateFunctions");
16780  aggregateFunctions->nodeId.identifier.numeric = UA_NS0ID_SERVER_SERVERCAPABILITIES_AGGREGATEFUNCTIONS;
16781  addNodeInternalWithType(server, (UA_Node*)aggregateFunctions,
16782  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERCAPABILITIES),
16783  nodeIdHasProperty, UA_NODEID_NUMERIC(0, UA_NS0ID_FOLDERTYPE));
16784 
16785  UA_ObjectNode *serverdiagnostics = UA_NodeStore_newObjectNode();
16786  copyNames((UA_Node*)serverdiagnostics, "ServerDiagnostics");
16787  serverdiagnostics->nodeId.identifier.numeric = UA_NS0ID_SERVER_SERVERDIAGNOSTICS;
16788  addNodeInternalWithType(server, (UA_Node*)serverdiagnostics,
16789  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER),
16790  nodeIdHasComponent, UA_NODEID_NUMERIC(0, UA_NS0ID_SERVERDIAGNOSTICSTYPE));
16791  UA_NodeId ServerDiagnosticsNodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERDIAGNOSTICS);
16792  deleteInstanceChildren(server, &ServerDiagnosticsNodeId);
16793 
16794  UA_VariableNode *enabledFlag = UA_NodeStore_newVariableNode();
16795  copyNames((UA_Node*)enabledFlag, "EnabledFlag");
16796  enabledFlag->nodeId.identifier.numeric = UA_NS0ID_SERVER_SERVERDIAGNOSTICS_ENABLEDFLAG;
16797  UA_Variant_setScalar(&enabledFlag->value.data.value.value, UA_Boolean_new(),
16798  &UA_TYPES[UA_TYPES_BOOLEAN]);
16799  enabledFlag->value.data.value.hasValue = true;
16800  enabledFlag->valueRank = 1;
16801  enabledFlag->minimumSamplingInterval = 1.0;
16802  addNodeInternalWithType(server, (UA_Node*)enabledFlag,
16803  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERDIAGNOSTICS),
16804  nodeIdHasProperty, UA_NODEID_NUMERIC(0, UA_NS0ID_PROPERTYTYPE));
16805 
16806  UA_VariableNode *serverstatus = UA_NodeStore_newVariableNode();
16807  copyNames((UA_Node*)serverstatus, "ServerStatus");
16808  serverstatus->nodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS);
16809  serverstatus->valueSource = UA_VALUESOURCE_DATASOURCE;
16810  serverstatus->value.dataSource = (UA_DataSource) {.handle = server, .read = readStatus,
16811  .write = NULL};
16812  addNodeInternalWithType(server, (UA_Node*)serverstatus, UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER),
16813  nodeIdHasComponent, UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE));
16814 
16815  UA_VariableNode *starttime = UA_NodeStore_newVariableNode();
16816  copyNames((UA_Node*)starttime, "StartTime");
16817  starttime->nodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS_STARTTIME);
16818  UA_Variant_setScalarCopy(&starttime->value.data.value.value,
16819  &server->startTime, &UA_TYPES[UA_TYPES_DATETIME]);
16820  starttime->value.data.value.hasValue = true;
16821  addNodeInternalWithType(server, (UA_Node*)starttime,
16822  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS),
16823  nodeIdHasComponent, UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE));
16824 
16825  UA_VariableNode *currenttime = UA_NodeStore_newVariableNode();
16826  copyNames((UA_Node*)currenttime, "CurrentTime");
16827  currenttime->nodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS_CURRENTTIME);
16828  currenttime->valueSource = UA_VALUESOURCE_DATASOURCE;
16829  currenttime->value.dataSource = (UA_DataSource) {.handle = NULL, .read = readCurrentTime,
16830  .write = NULL};
16831  addNodeInternalWithType(server, (UA_Node*)currenttime,
16832  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS),
16833  nodeIdHasComponent, UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE));
16834 
16835  UA_VariableNode *state = UA_NodeStore_newVariableNode();
16836  copyNames((UA_Node*)state, "State");
16837  state->nodeId.identifier.numeric = UA_NS0ID_SERVER_SERVERSTATUS_STATE;
16838  UA_Variant_setScalar(&state->value.data.value.value, UA_ServerState_new(),
16839  &UA_TYPES[UA_TYPES_SERVERSTATE]);
16840  state->value.data.value.hasValue = true;
16841  state->minimumSamplingInterval = 500.0f;
16842  addNodeInternalWithType(server, (UA_Node*)state, UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS),
16843  nodeIdHasComponent, UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE));
16844 
16845  UA_VariableNode *buildinfo = UA_NodeStore_newVariableNode();
16846  copyNames((UA_Node*)buildinfo, "BuildInfo");
16847  buildinfo->nodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO);
16848  UA_Variant_setScalarCopy(&buildinfo->value.data.value.value,
16849  &server->config.buildInfo, &UA_TYPES[UA_TYPES_BUILDINFO]);
16850  buildinfo->value.data.value.hasValue = true;
16851  addNodeInternalWithType(server, (UA_Node*)buildinfo,
16852  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS),
16853  nodeIdHasComponent, UA_NODEID_NUMERIC(0, UA_NS0ID_BUILDINFOTYPE));
16854 
16855  UA_VariableNode *producturi = UA_NodeStore_newVariableNode();
16856  copyNames((UA_Node*)producturi, "ProductUri");
16857  producturi->nodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO_PRODUCTURI);
16858  UA_Variant_setScalarCopy(&producturi->value.data.value.value, &server->config.buildInfo.productUri,
16859  &UA_TYPES[UA_TYPES_STRING]);
16860  producturi->value.data.value.hasValue = true;
16861  addNodeInternalWithType(server, (UA_Node*)producturi,
16862  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO),
16863  nodeIdHasComponent, UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE));
16864 
16865  UA_VariableNode *manufacturername = UA_NodeStore_newVariableNode();
16866  copyNames((UA_Node*)manufacturername, "ManufacturerName");
16867  manufacturername->nodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO_MANUFACTURERNAME);
16868  UA_Variant_setScalarCopy(&manufacturername->value.data.value.value,
16869  &server->config.buildInfo.manufacturerName,
16870  &UA_TYPES[UA_TYPES_STRING]);
16871  manufacturername->value.data.value.hasValue = true;
16872  addNodeInternalWithType(server, (UA_Node*)manufacturername,
16873  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO),
16874  nodeIdHasComponent, UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE));
16875 
16876  UA_VariableNode *productname = UA_NodeStore_newVariableNode();
16877  copyNames((UA_Node*)productname, "ProductName");
16878  productname->nodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO_PRODUCTNAME);
16879  UA_Variant_setScalarCopy(&productname->value.data.value.value, &server->config.buildInfo.productName,
16880  &UA_TYPES[UA_TYPES_STRING]);
16881  productname->value.data.value.hasValue = true;
16882  addNodeInternalWithType(server, (UA_Node*)productname,
16883  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO),
16884  nodeIdHasComponent, UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE));
16885 
16886  UA_VariableNode *softwareversion = UA_NodeStore_newVariableNode();
16887  copyNames((UA_Node*)softwareversion, "SoftwareVersion");
16888  softwareversion->nodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO_SOFTWAREVERSION);
16889  UA_Variant_setScalarCopy(&softwareversion->value.data.value.value,
16890  &server->config.buildInfo.softwareVersion, &UA_TYPES[UA_TYPES_STRING]);
16891  softwareversion->value.data.value.hasValue = true;
16892  addNodeInternalWithType(server, (UA_Node*)softwareversion,
16893  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO),
16894  nodeIdHasComponent, UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE));
16895 
16896  UA_VariableNode *buildnumber = UA_NodeStore_newVariableNode();
16897  copyNames((UA_Node*)buildnumber, "BuildNumber");
16898  buildnumber->nodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO_BUILDNUMBER);
16899  UA_Variant_setScalarCopy(&buildnumber->value.data.value.value, &server->config.buildInfo.buildNumber,
16900  &UA_TYPES[UA_TYPES_STRING]);
16901  buildnumber->value.data.value.hasValue = true;
16902  addNodeInternalWithType(server, (UA_Node*)buildnumber,
16903  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO),
16904  nodeIdHasComponent, UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE));
16905 
16906  UA_VariableNode *builddate = UA_NodeStore_newVariableNode();
16907  copyNames((UA_Node*)builddate, "BuildDate");
16908  builddate->nodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO_BUILDDATE);
16909  UA_Variant_setScalarCopy(&builddate->value.data.value.value, &server->config.buildInfo.buildDate,
16910  &UA_TYPES[UA_TYPES_DATETIME]);
16911  builddate->value.data.value.hasValue = true;
16912  addNodeInternalWithType(server, (UA_Node*)builddate,
16913  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO),
16914  nodeIdHasComponent, UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE));
16915 
16916  UA_VariableNode *secondstillshutdown = UA_NodeStore_newVariableNode();
16917  copyNames((UA_Node*)secondstillshutdown, "SecondsTillShutdown");
16918  secondstillshutdown->nodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS_SECONDSTILLSHUTDOWN);
16919  UA_Variant_setScalar(&secondstillshutdown->value.data.value.value, UA_UInt32_new(),
16920  &UA_TYPES[UA_TYPES_UINT32]);
16921  secondstillshutdown->value.data.value.hasValue = true;
16922  addNodeInternalWithType(server, (UA_Node*)secondstillshutdown,
16923  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS),
16924  nodeIdHasComponent, UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE));
16925 
16926  UA_VariableNode *shutdownreason = UA_NodeStore_newVariableNode();
16927  copyNames((UA_Node*)shutdownreason, "ShutdownReason");
16928  shutdownreason->nodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS_SHUTDOWNREASON);
16929  UA_Variant_setScalar(&shutdownreason->value.data.value.value, UA_LocalizedText_new(),
16930  &UA_TYPES[UA_TYPES_LOCALIZEDTEXT]);
16931  shutdownreason->value.data.value.hasValue = true;
16932  addNodeInternalWithType(server, (UA_Node*)shutdownreason,
16933  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS),
16934  nodeIdHasComponent, UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE));
16935 
16936  UA_VariableNode *servicelevel = UA_NodeStore_newVariableNode();
16937  copyNames((UA_Node*)servicelevel, "ServiceLevel");
16938  servicelevel->nodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVICELEVEL);
16939  servicelevel->valueSource = UA_VALUESOURCE_DATASOURCE;
16940  servicelevel->value.dataSource = (UA_DataSource) {.handle = server, .read = readServiceLevel,
16941  .write = NULL};
16942  addNodeInternalWithType(server, (UA_Node*)servicelevel,
16943  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER), nodeIdHasComponent,
16944  UA_NODEID_NUMERIC(0, UA_NS0ID_PROPERTYTYPE));
16945 
16946  UA_VariableNode *auditing = UA_NodeStore_newVariableNode();
16947  copyNames((UA_Node*)auditing, "Auditing");
16948  auditing->nodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_AUDITING);
16949  auditing->valueSource = UA_VALUESOURCE_DATASOURCE;
16950  auditing->value.dataSource = (UA_DataSource) {.handle = server, .read = readAuditing, .write = NULL};
16951  addNodeInternalWithType(server, (UA_Node*)auditing,
16952  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER), nodeIdHasComponent,
16953  UA_NODEID_NUMERIC(0, UA_NS0ID_PROPERTYTYPE));
16954 
16955  UA_ObjectNode *vendorServerInfo = UA_NodeStore_newObjectNode();
16956  copyNames((UA_Node*)vendorServerInfo, "VendorServerInfo");
16957  vendorServerInfo->nodeId.identifier.numeric = UA_NS0ID_SERVER_VENDORSERVERINFO;
16958  addNodeInternalWithType(server, (UA_Node*)vendorServerInfo,
16959  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER), nodeIdHasProperty,
16960  UA_NODEID_NUMERIC(0, UA_NS0ID_BASEOBJECTTYPE));
16961  /*
16962  UA_Server_addReference(server, UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_VENDORSERVERINFO),
16963  nodeIdHasTypeDefinition, UA_EXPANDEDNODEID_NUMERIC(0, UA_NS0ID_VENDORSERVERINFOTYPE), true);
16964  */
16965 
16966 
16967  UA_ObjectNode *serverRedundancy = UA_NodeStore_newObjectNode();
16968  copyNames((UA_Node*)serverRedundancy, "ServerRedundancy");
16969  serverRedundancy->nodeId.identifier.numeric = UA_NS0ID_SERVER_SERVERREDUNDANCY;
16970  addNodeInternalWithType(server, (UA_Node*)serverRedundancy,
16971  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER), nodeIdHasProperty,
16972  UA_NODEID_NUMERIC(0, UA_NS0ID_BASEOBJECTTYPE));
16973  /*
16974  UA_Server_addReference(server, UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERREDUNDANCY),
16975  nodeIdHasTypeDefinition, UA_EXPANDEDNODEID_NUMERIC(0, UA_NS0ID_SERVERREDUNDANCYTYPE), true);
16976  */
16977 
16978  UA_VariableNode *redundancySupport = UA_NodeStore_newVariableNode();
16979  copyNames((UA_Node*)redundancySupport, "RedundancySupport");
16980  redundancySupport->nodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERREDUNDANCY_REDUNDANCYSUPPORT);
16981  redundancySupport->valueRank = -1;
16982  redundancySupport->dataType = UA_TYPES[UA_TYPES_INT32].typeId;
16983  //FIXME: enum is needed for type letting it uninitialized for now
16984  UA_Variant_setScalar(&redundancySupport->value.data.value.value, UA_Int32_new(),
16985  &UA_TYPES[UA_TYPES_INT32]);
16986  redundancySupport->value.data.value.hasValue = true;
16987  addNodeInternalWithType(server, (UA_Node*)redundancySupport,
16988  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERREDUNDANCY),
16989  nodeIdHasProperty, UA_NODEID_NUMERIC(0, UA_NS0ID_PROPERTYTYPE));
16990 
16991 #if defined(UA_ENABLE_METHODCALLS) && defined(UA_ENABLE_SUBSCRIPTIONS)
16992  UA_Argument inputArguments;
16993  UA_Argument_init(&inputArguments);
16994  inputArguments.dataType = UA_TYPES[UA_TYPES_UINT32].typeId;
16995  inputArguments.name = UA_STRING("SubscriptionId");
16996  inputArguments.valueRank = -1; /* scalar argument */
16997 
16998  UA_Argument outputArguments[2];
16999  UA_Argument_init(&outputArguments[0]);
17000  outputArguments[0].dataType = UA_TYPES[UA_TYPES_UINT32].typeId;
17001  outputArguments[0].name = UA_STRING("ServerHandles");
17002  outputArguments[0].valueRank = 1;
17003 
17004  UA_Argument_init(&outputArguments[1]);
17005  outputArguments[1].dataType = UA_TYPES[UA_TYPES_UINT32].typeId;
17006  outputArguments[1].name = UA_STRING("ClientHandles");
17007  outputArguments[1].valueRank = 1;
17008 
17009  UA_MethodAttributes addmethodattributes;
17010  UA_MethodAttributes_init(&addmethodattributes);
17011  addmethodattributes.displayName = UA_LOCALIZEDTEXT("", "GetMonitoredItems");
17012  addmethodattributes.executable = true;
17013  addmethodattributes.userExecutable = true;
17014 
17015  UA_Server_addMethodNode(server, UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_GETMONITOREDITEMS),
17016  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER),
17017  UA_NODEID_NUMERIC(0, UA_NS0ID_HASCOMPONENT),
17018  UA_QUALIFIEDNAME(0, "GetMonitoredItems"), addmethodattributes,
17019  GetMonitoredItems, /* callback of the method node */
17020  NULL, /* handle passed with the callback */
17021  1, &inputArguments, 2, outputArguments, NULL);
17022 #endif
17023 
17024  return server;
17025 }
17026 
17027 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_server_binary.c" ***********************************/
17028 
17029 /* This Source Code Form is subject to the terms of the Mozilla Public
17030 * License, v. 2.0. If a copy of the MPL was not distributed with this
17031 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
17032 
17033 
17034 /********************/
17035 /* Helper Functions */
17036 /********************/
17037 
17038 static void
17039 sendError(UA_SecureChannel *channel, const UA_ByteString *msg,
17040  size_t offset, const UA_DataType *responseType,
17041  UA_UInt32 requestId, UA_StatusCode error) {
17042  UA_RequestHeader requestHeader;
17043  UA_StatusCode retval = UA_RequestHeader_decodeBinary(msg, &offset, &requestHeader);
17044  if(retval != UA_STATUSCODE_GOOD)
17045  return;
17046  void *response = UA_alloca(responseType->memSize);
17047  UA_init(response, responseType);
17048  UA_ResponseHeader *responseHeader = (UA_ResponseHeader*)response;
17049  responseHeader->requestHandle = requestHeader.requestHandle;
17050  responseHeader->timestamp = UA_DateTime_now();
17051  responseHeader->serviceResult = error;
17052  UA_SecureChannel_sendBinaryMessage(channel, requestId, response, responseType);
17053  UA_RequestHeader_deleteMembers(&requestHeader);
17054  UA_ResponseHeader_deleteMembers(responseHeader);
17055 }
17056 
17057 static void
17058 getServicePointers(UA_UInt32 requestTypeId, const UA_DataType **requestType,
17059  const UA_DataType **responseType, UA_Service *service,
17060  UA_Boolean *requiresSession) {
17061  switch(requestTypeId) {
17063  *service = (UA_Service)Service_GetEndpoints;
17064  *requestType = &UA_TYPES[UA_TYPES_GETENDPOINTSREQUEST];
17065  *responseType = &UA_TYPES[UA_TYPES_GETENDPOINTSRESPONSE];
17066  *requiresSession = false;
17067  break;
17069  *service = (UA_Service)Service_FindServers;
17070  *requestType = &UA_TYPES[UA_TYPES_FINDSERVERSREQUEST];
17071  *responseType = &UA_TYPES[UA_TYPES_FINDSERVERSRESPONSE];
17072  *requiresSession = false;
17073  break;
17075  *service = (UA_Service)Service_CreateSession;
17076  *requestType = &UA_TYPES[UA_TYPES_CREATESESSIONREQUEST];
17077  *responseType = &UA_TYPES[UA_TYPES_CREATESESSIONRESPONSE];
17078  *requiresSession = false;
17079  break;
17081  *service = (UA_Service)Service_ActivateSession;
17082  *requestType = &UA_TYPES[UA_TYPES_ACTIVATESESSIONREQUEST];
17083  *responseType = &UA_TYPES[UA_TYPES_ACTIVATESESSIONRESPONSE];
17084  break;
17086  *service = (UA_Service)Service_CloseSession;
17087  *requestType = &UA_TYPES[UA_TYPES_CLOSESESSIONREQUEST];
17088  *responseType = &UA_TYPES[UA_TYPES_CLOSESESSIONRESPONSE];
17089  break;
17091  *service = (UA_Service)Service_Read;
17092  *requestType = &UA_TYPES[UA_TYPES_READREQUEST];
17093  *responseType = &UA_TYPES[UA_TYPES_READRESPONSE];
17094  break;
17096  *service = (UA_Service)Service_Write;
17097  *requestType = &UA_TYPES[UA_TYPES_WRITEREQUEST];
17098  *responseType = &UA_TYPES[UA_TYPES_WRITERESPONSE];
17099  break;
17101  *service = (UA_Service)Service_Browse;
17102  *requestType = &UA_TYPES[UA_TYPES_BROWSEREQUEST];
17103  *responseType = &UA_TYPES[UA_TYPES_BROWSERESPONSE];
17104  break;
17106  *service = (UA_Service)Service_BrowseNext;
17107  *requestType = &UA_TYPES[UA_TYPES_BROWSENEXTREQUEST];
17108  *responseType = &UA_TYPES[UA_TYPES_BROWSENEXTRESPONSE];
17109  break;
17111  *service = (UA_Service)Service_RegisterNodes;
17112  *requestType = &UA_TYPES[UA_TYPES_REGISTERNODESREQUEST];
17113  *responseType = &UA_TYPES[UA_TYPES_REGISTERNODESRESPONSE];
17114  break;
17116  *service = (UA_Service)Service_UnregisterNodes;
17117  *requestType = &UA_TYPES[UA_TYPES_UNREGISTERNODESREQUEST];
17118  *responseType = &UA_TYPES[UA_TYPES_UNREGISTERNODESRESPONSE];
17119  break;
17122  *requestType = &UA_TYPES[UA_TYPES_TRANSLATEBROWSEPATHSTONODEIDSREQUEST];
17123  *responseType = &UA_TYPES[UA_TYPES_TRANSLATEBROWSEPATHSTONODEIDSRESPONSE];
17124  break;
17125 
17126 #ifdef UA_ENABLE_SUBSCRIPTIONS
17129  *requestType = &UA_TYPES[UA_TYPES_CREATESUBSCRIPTIONREQUEST];
17130  *responseType = &UA_TYPES[UA_TYPES_CREATESUBSCRIPTIONRESPONSE];
17131  break;
17133  *requestType = &UA_TYPES[UA_TYPES_PUBLISHREQUEST];
17134  *responseType = &UA_TYPES[UA_TYPES_PUBLISHRESPONSE];
17135  break;
17137  *service = (UA_Service)Service_Republish;
17138  *requestType = &UA_TYPES[UA_TYPES_REPUBLISHREQUEST];
17139  *responseType = &UA_TYPES[UA_TYPES_REPUBLISHRESPONSE];
17140  break;
17143  *requestType = &UA_TYPES[UA_TYPES_MODIFYSUBSCRIPTIONREQUEST];
17144  *responseType = &UA_TYPES[UA_TYPES_MODIFYSUBSCRIPTIONRESPONSE];
17145  break;
17148  *requestType = &UA_TYPES[UA_TYPES_SETPUBLISHINGMODEREQUEST];
17149  *responseType = &UA_TYPES[UA_TYPES_SETPUBLISHINGMODERESPONSE];
17150  break;
17153  *requestType = &UA_TYPES[UA_TYPES_DELETESUBSCRIPTIONSREQUEST];
17154  *responseType = &UA_TYPES[UA_TYPES_DELETESUBSCRIPTIONSRESPONSE];
17155  break;
17158  *requestType = &UA_TYPES[UA_TYPES_CREATEMONITOREDITEMSREQUEST];
17159  *responseType = &UA_TYPES[UA_TYPES_CREATEMONITOREDITEMSRESPONSE];
17160  break;
17163  *requestType = &UA_TYPES[UA_TYPES_DELETEMONITOREDITEMSREQUEST];
17164  *responseType = &UA_TYPES[UA_TYPES_DELETEMONITOREDITEMSRESPONSE];
17165  break;
17168  *requestType = &UA_TYPES[UA_TYPES_MODIFYMONITOREDITEMSREQUEST];
17169  *responseType = &UA_TYPES[UA_TYPES_MODIFYMONITOREDITEMSRESPONSE];
17170  break;
17173  *requestType = &UA_TYPES[UA_TYPES_SETMONITORINGMODEREQUEST];
17174  *responseType = &UA_TYPES[UA_TYPES_SETMONITORINGMODERESPONSE];
17175  break;
17176 #endif
17177 
17178 #ifdef UA_ENABLE_METHODCALLS
17180  *service = (UA_Service)Service_Call;
17181  *requestType = &UA_TYPES[UA_TYPES_CALLREQUEST];
17182  *responseType = &UA_TYPES[UA_TYPES_CALLRESPONSE];
17183  break;
17184 #endif
17185 
17186 #ifdef UA_ENABLE_NODEMANAGEMENT
17188  *service = (UA_Service)Service_AddNodes;
17189  *requestType = &UA_TYPES[UA_TYPES_ADDNODESREQUEST];
17190  *responseType = &UA_TYPES[UA_TYPES_ADDNODESRESPONSE];
17191  break;
17193  *service = (UA_Service)Service_AddReferences;
17194  *requestType = &UA_TYPES[UA_TYPES_ADDREFERENCESREQUEST];
17195  *responseType = &UA_TYPES[UA_TYPES_ADDREFERENCESRESPONSE];
17196  break;
17198  *service = (UA_Service)Service_DeleteNodes;
17199  *requestType = &UA_TYPES[UA_TYPES_DELETENODESREQUEST];
17200  *responseType = &UA_TYPES[UA_TYPES_DELETENODESRESPONSE];
17201  break;
17204  *requestType = &UA_TYPES[UA_TYPES_DELETEREFERENCESREQUEST];
17205  *responseType = &UA_TYPES[UA_TYPES_DELETEREFERENCESRESPONSE];
17206  break;
17207 #endif
17208 
17209  default:
17210  break;
17211  }
17212 }
17213 
17214 /*************************/
17215 /* Process Message Types */
17216 /*************************/
17217 
17218 /* HEL -> Open up the connection */
17219 static void processHEL(UA_Connection *connection, const UA_ByteString *msg, size_t *offset) {
17220  UA_TcpHelloMessage helloMessage;
17221  if(UA_TcpHelloMessage_decodeBinary(msg, offset, &helloMessage) != UA_STATUSCODE_GOOD) {
17222  connection->close(connection);
17223  return;
17224  }
17225 
17226  /* Parameterize the connection */
17227  connection->remoteConf.maxChunkCount = helloMessage.maxChunkCount; /* zero -> unlimited */
17228  connection->remoteConf.maxMessageSize = helloMessage.maxMessageSize; /* zero -> unlimited */
17229  connection->remoteConf.protocolVersion = helloMessage.protocolVersion;
17230  connection->remoteConf.recvBufferSize = helloMessage.receiveBufferSize;
17231  if(connection->localConf.sendBufferSize > helloMessage.receiveBufferSize)
17232  connection->localConf.sendBufferSize = helloMessage.receiveBufferSize;
17233  connection->remoteConf.sendBufferSize = helloMessage.sendBufferSize;
17234  if(connection->localConf.recvBufferSize > helloMessage.sendBufferSize)
17235  connection->localConf.recvBufferSize = helloMessage.sendBufferSize;
17236  connection->state = UA_CONNECTION_ESTABLISHED;
17237  UA_TcpHelloMessage_deleteMembers(&helloMessage);
17238 
17239  /* Build acknowledge response */
17240  UA_TcpAcknowledgeMessage ackMessage;
17241  ackMessage.protocolVersion = connection->localConf.protocolVersion;
17242  ackMessage.receiveBufferSize = connection->localConf.recvBufferSize;
17243  ackMessage.sendBufferSize = connection->localConf.sendBufferSize;
17244  ackMessage.maxMessageSize = connection->localConf.maxMessageSize;
17245  ackMessage.maxChunkCount = connection->localConf.maxChunkCount;
17246 
17247  UA_TcpMessageHeader ackHeader;
17249  ackHeader.messageSize = 8 + 20; /* ackHeader + ackMessage */
17250 
17251  /* Get the send buffer from the network layer */
17252  UA_ByteString ack_msg;
17253  UA_ByteString_init(&ack_msg);
17254  UA_StatusCode retval =
17255  connection->getSendBuffer(connection, connection->localConf.sendBufferSize, &ack_msg);
17256  if(retval != UA_STATUSCODE_GOOD)
17257  return;
17258 
17259  /* Encode and send the response */
17260  size_t tmpPos = 0;
17261  UA_TcpMessageHeader_encodeBinary(&ackHeader, &ack_msg, &tmpPos);
17262  UA_TcpAcknowledgeMessage_encodeBinary(&ackMessage, &ack_msg, &tmpPos);
17263  ack_msg.length = ackHeader.messageSize;
17264  connection->send(connection, &ack_msg);
17265 }
17266 
17267 /* OPN -> Open up/renew the securechannel */
17268 static void
17269 processOPN(UA_Server *server, UA_Connection *connection,
17270  UA_UInt32 channelId, const UA_ByteString *msg) {
17272  /* Called before HEL */
17273  if(connection->state != UA_CONNECTION_ESTABLISHED)
17275  /* Opening up a channel with a channelid already set */
17276  if(!connection->channel && channelId != 0)
17278  /* Renew a channel with the wrong channelid */
17279  if(connection->channel && channelId != connection->channel->securityToken.channelId)
17281 
17282  /* Decode the request */
17284  UA_SequenceHeader seqHeader;
17285  UA_NodeId requestType;
17287  size_t offset = 0;
17288  retval |= UA_AsymmetricAlgorithmSecurityHeader_decodeBinary(msg, &offset, &asymHeader);
17289  retval |= UA_SequenceHeader_decodeBinary(msg, &offset, &seqHeader);
17290  retval |= UA_NodeId_decodeBinary(msg, &offset, &requestType);
17291  retval |= UA_OpenSecureChannelRequest_decodeBinary(msg, &offset, &r);
17292 
17293  /* Error occured */
17294  if(retval != UA_STATUSCODE_GOOD || requestType.identifier.numeric != 446) {
17295  UA_AsymmetricAlgorithmSecurityHeader_deleteMembers(&asymHeader);
17296  UA_NodeId_deleteMembers(&requestType);
17297  UA_OpenSecureChannelRequest_deleteMembers(&r);
17298  connection->close(connection);
17299  return;
17300  }
17301 
17302  /* Call the service */
17304  UA_OpenSecureChannelResponse_init(&p);
17305  Service_OpenSecureChannel(server, connection, &r, &p);
17306  UA_OpenSecureChannelRequest_deleteMembers(&r);
17307 
17308  /* Opening the channel failed */
17309  UA_SecureChannel *channel = connection->channel;
17310  if(!channel) {
17311  UA_OpenSecureChannelResponse_deleteMembers(&p);
17312  UA_AsymmetricAlgorithmSecurityHeader_deleteMembers(&asymHeader);
17313  connection->close(connection);
17314  return;
17315  }
17316 
17317  /* Set the starting sequence number */
17318  channel->receiveSequenceNumber = seqHeader.sequenceNumber;
17319 
17320  /* Allocate the return message */
17321  UA_ByteString resp_msg;
17322  UA_ByteString_init(&resp_msg);
17323  retval = connection->getSendBuffer(connection, connection->localConf.sendBufferSize, &resp_msg);
17324  if(retval != UA_STATUSCODE_GOOD) {
17325  UA_OpenSecureChannelResponse_deleteMembers(&p);
17326  UA_AsymmetricAlgorithmSecurityHeader_deleteMembers(&asymHeader);
17327  connection->close(connection);
17328  return;
17329  }
17330 
17331  /* Encode the message after the secureconversationmessageheader */
17332  size_t tmpPos = 12; /* skip the header */
17333  seqHeader.sequenceNumber = UA_atomic_add(&channel->sendSequenceNumber, 1);
17334  retval |= UA_AsymmetricAlgorithmSecurityHeader_encodeBinary(&asymHeader, &resp_msg, &tmpPos); // just mirror back
17335  retval |= UA_SequenceHeader_encodeBinary(&seqHeader, &resp_msg, &tmpPos);
17336  UA_NodeId responseType = UA_NODEID_NUMERIC(0, UA_TYPES[UA_TYPES_OPENSECURECHANNELRESPONSE].binaryEncodingId);
17337  retval |= UA_NodeId_encodeBinary(&responseType, &resp_msg, &tmpPos);
17338  retval |= UA_OpenSecureChannelResponse_encodeBinary(&p, &resp_msg, &tmpPos);
17339 
17340  if(retval != UA_STATUSCODE_GOOD) {
17341  connection->releaseSendBuffer(connection, &resp_msg);
17342  UA_OpenSecureChannelResponse_deleteMembers(&p);
17343  UA_AsymmetricAlgorithmSecurityHeader_deleteMembers(&asymHeader);
17344  connection->close(connection);
17345  return;
17346  }
17347 
17348  /* Encode the secureconversationmessageheader (cannot fail) and send */
17351  respHeader.messageHeader.messageSize = (UA_UInt32)tmpPos;
17352  respHeader.secureChannelId = p.securityToken.channelId;
17353  tmpPos = 0;
17354  UA_SecureConversationMessageHeader_encodeBinary(&respHeader, &resp_msg, &tmpPos);
17355  resp_msg.length = respHeader.messageHeader.messageSize;
17356  connection->send(connection, &resp_msg);
17357 
17358  /* Clean up */
17359  UA_OpenSecureChannelResponse_deleteMembers(&p);
17360  UA_AsymmetricAlgorithmSecurityHeader_deleteMembers(&asymHeader);
17361 }
17362 
17363 static void
17364 processMSG(UA_Server *server, UA_SecureChannel *channel,
17365  UA_UInt32 requestId, const UA_ByteString *msg) {
17366  /* At 0, the nodeid starts... */
17367  size_t ppos = 0;
17368  size_t *offset = &ppos;
17369 
17370  /* Decode the nodeid */
17371  UA_NodeId requestTypeId;
17372  UA_StatusCode retval = UA_NodeId_decodeBinary(msg, offset, &requestTypeId);
17373  if(retval != UA_STATUSCODE_GOOD)
17374  return;
17375  if(requestTypeId.identifierType != UA_NODEIDTYPE_NUMERIC)
17376  UA_NodeId_deleteMembers(&requestTypeId); /* leads to badserviceunsupported */
17377 
17378  /* Store the start-position of the request */
17379  size_t requestPos = *offset;
17380 
17381  /* Get the service pointers */
17382  UA_Service service = NULL;
17383  const UA_DataType *requestType = NULL;
17384  const UA_DataType *responseType = NULL;
17385  UA_Boolean sessionRequired = true;
17386  getServicePointers(requestTypeId.identifier.numeric, &requestType,
17387  &responseType, &service, &sessionRequired);
17388  if(!requestType) {
17389  if(requestTypeId.identifier.numeric == 787) {
17390  UA_LOG_INFO_CHANNEL(server->config.logger, channel,
17391  "Client requested a subscription, " \
17392  "but those are not enabled in the build");
17393  } else {
17394  UA_LOG_INFO_CHANNEL(server->config.logger, channel,
17395  "Unknown request with type identifier %i",
17396  requestTypeId.identifier.numeric);
17397  }
17398  sendError(channel, msg, requestPos, &UA_TYPES[UA_TYPES_SERVICEFAULT],
17400  return;
17401  }
17402  UA_assert(responseType);
17403 
17404 #ifdef UA_ENABLE_NONSTANDARD_STATELESS
17405  /* Stateless extension: Sessions are optional */
17406  sessionRequired = false;
17407 #endif
17408 
17409  /* Decode the request */
17410  void *request = UA_alloca(requestType->memSize);
17411  UA_RequestHeader *requestHeader = (UA_RequestHeader*)request;
17412  retval = UA_decodeBinary(msg, offset, request, requestType);
17413  if(retval != UA_STATUSCODE_GOOD) {
17414  UA_LOG_DEBUG_CHANNEL(server->config.logger, channel,
17415  "Could not decode the request");
17416  sendError(channel, msg, requestPos, responseType, requestId, retval);
17417  return;
17418  }
17419 
17420  /* Prepare the respone */
17421  void *response = UA_alloca(responseType->memSize);
17422  UA_init(response, responseType);
17423  UA_Session *session = NULL; /* must be initialized before goto send_response */
17424 
17425  /* CreateSession doesn't need a session */
17426  if(requestType == &UA_TYPES[UA_TYPES_CREATESESSIONREQUEST]) {
17427  Service_CreateSession(server, channel, request, response);
17428  goto send_response;
17429  }
17430 
17431  /* Find the matching session */
17432  session = UA_SecureChannel_getSession(channel, &requestHeader->authenticationToken);
17433  if(!session)
17434  session = UA_SessionManager_getSession(&server->sessionManager,
17435  &requestHeader->authenticationToken);
17436 
17437  if(requestType == &UA_TYPES[UA_TYPES_ACTIVATESESSIONREQUEST]) {
17438  if(!session) {
17439  UA_LOG_DEBUG_CHANNEL(server->config.logger, channel,
17440  "Trying to activate a session that is " \
17441  "not known in the server");
17442  sendError(channel, msg, requestPos, responseType,
17444  UA_deleteMembers(request, requestType);
17445  return;
17446  }
17447  Service_ActivateSession(server, channel, session, request, response);
17448  goto send_response;
17449  }
17450 
17451  /* Set an anonymous, inactive session for services that need no session */
17452  UA_Session anonymousSession;
17453  if(!session) {
17454  if(sessionRequired) {
17455  UA_LOG_INFO_CHANNEL(server->config.logger, channel,
17456  "Service request %i without a valid session",
17457  requestType->binaryEncodingId);
17458  sendError(channel, msg, requestPos, responseType,
17460  UA_deleteMembers(request, requestType);
17461  if(++channel->invalidSessionAccessCounter > 3)
17462  Service_CloseSecureChannel(server, channel);
17463  return;
17464  }
17465  UA_Session_init(&anonymousSession);
17466  anonymousSession.sessionId = UA_NODEID_GUID(0, UA_GUID_NULL);
17467  anonymousSession.channel = channel;
17468  session = &anonymousSession;
17469  }
17470  channel->invalidSessionAccessCounter = 0;
17471 
17472  /* Trying to use a non-activated session? */
17473  if(sessionRequired && !session->activated) {
17474  UA_LOG_INFO_SESSION(server->config.logger, session,
17475  "Calling service %i on a non-activated session",
17476  requestType->binaryEncodingId);
17477  sendError(channel, msg, requestPos, responseType,
17480  &session->authenticationToken);
17481  UA_deleteMembers(request, requestType);
17482  return;
17483  }
17484 
17485  /* The session is bound to another channel */
17486  if(session->channel != channel) {
17487  UA_LOG_DEBUG_CHANNEL(server->config.logger, channel,
17488  "Client tries to use an obsolete securechannel");
17489  sendError(channel, msg, requestPos, responseType,
17491  UA_deleteMembers(request, requestType);
17492  return;
17493  }
17494 
17495  /* Update the session lifetime */
17496  UA_Session_updateLifetime(session);
17497 
17498 #ifdef UA_ENABLE_SUBSCRIPTIONS
17499  /* The publish request is not answered immediately */
17500  if(requestType == &UA_TYPES[UA_TYPES_PUBLISHREQUEST]) {
17501  Service_Publish(server, session, request, requestId);
17502  UA_deleteMembers(request, requestType);
17503  return;
17504  }
17505 #endif
17506 
17507  /* Call the service */
17508  UA_assert(service); /* For all services besides publish, the service pointer is non-NULL*/
17509  service(server, session, request, response);
17510 
17511  send_response:
17512  /* Send the response */
17513  ((UA_ResponseHeader*)response)->requestHandle = requestHeader->requestHandle;
17514  ((UA_ResponseHeader*)response)->timestamp = UA_DateTime_now();
17515  retval = UA_SecureChannel_sendBinaryMessage(channel, requestId, response, responseType);
17516 
17517  if(retval != UA_STATUSCODE_GOOD)
17518  UA_LOG_INFO_CHANNEL(server->config.logger, channel,
17519  "Could not send the message over the SecureChannel "
17520  "with StatusCode %s", UA_StatusCode_name(retval));
17521 
17522  /* Clean up */
17523  UA_deleteMembers(request, requestType);
17524  UA_deleteMembers(response, responseType);
17525 }
17526 
17527 /* ERR -> Error from the remote connection */
17528 static void processERR(UA_Server *server, UA_Connection *connection, const UA_ByteString *msg, size_t *offset) {
17529  UA_TcpErrorMessage errorMessage;
17530  if (UA_TcpErrorMessage_decodeBinary(msg, offset, &errorMessage) != UA_STATUSCODE_GOOD) {
17531  connection->close(connection);
17532  return;
17533  }
17534 
17535  UA_LOG_ERROR(server->config.logger, UA_LOGCATEGORY_NETWORK,
17536  "Client replied with an error message: %s %.*s",
17537  UA_StatusCode_name(errorMessage.error), errorMessage.reason.length, errorMessage.reason.data);
17538 }
17539 
17540 /* Takes decoded messages starting at the nodeid of the content type. Only OPN
17541  * messages start at the asymmetricalgorithmsecurityheader and are not
17542  * decoded. */
17543 static void
17544 UA_Server_processSecureChannelMessage(UA_Server *server, UA_SecureChannel *channel,
17545  UA_MessageType messagetype, UA_UInt32 requestId,
17546  const UA_ByteString *message) {
17547  UA_assert(channel);
17548  UA_assert(channel->connection);
17549  switch(messagetype) {
17550  case UA_MESSAGETYPE_ERR: {
17551  const UA_TcpErrorMessage *msg = (const UA_TcpErrorMessage *) message;
17552  UA_LOG_ERROR_CHANNEL(server->config.logger, channel,
17553  "Client replied with an error message: %s %.*s",
17554  UA_StatusCode_name(msg->error), msg->reason.length, msg->reason.data);
17555  break;
17556  }
17557  case UA_MESSAGETYPE_HEL:
17558  UA_LOG_TRACE_CHANNEL(server->config.logger, channel,
17559  "Cannot process a HEL on an open channel");
17560  break;
17561  case UA_MESSAGETYPE_OPN:
17562  UA_LOG_TRACE_CHANNEL(server->config.logger, channel,
17563  "Process an OPN on an open channel");
17564  processOPN(server, channel->connection, channel->securityToken.channelId, message);
17565  break;
17566  case UA_MESSAGETYPE_MSG:
17567  UA_LOG_TRACE_CHANNEL(server->config.logger, channel,
17568  "Process a MSG", channel->connection->sockfd);
17569  processMSG(server, channel, requestId, message);
17570  break;
17571  case UA_MESSAGETYPE_CLO:
17572  UA_LOG_TRACE_CHANNEL(server->config.logger, channel,
17573  "Process a CLO", channel->connection->sockfd);
17574  Service_CloseSecureChannel(server, channel);
17575  break;
17576  default:
17577  UA_LOG_TRACE_CHANNEL(server->config.logger, channel,
17578  "Unknown message type");
17579  }
17580 }
17581 
17582 /* Takes the raw message from the network layer */
17583 void
17584 UA_Server_processBinaryMessage(UA_Server *server, UA_Connection *connection,
17585  const UA_ByteString *message) {
17586  UA_SecureChannel *channel = connection->channel;
17587  if(channel) {
17588  /* Assemble chunks in the securechannel and process complete messages */
17589  UA_StatusCode retval =
17590  UA_SecureChannel_processChunks(channel, message,
17591  (UA_ProcessMessageCallback*)UA_Server_processSecureChannelMessage, server);
17592  if(retval != UA_STATUSCODE_GOOD)
17593  UA_LOG_TRACE_CHANNEL(server->config.logger, channel, "Procesing chunks "
17594  "resulted in error code %s", UA_StatusCode_name(retval));
17595  } else {
17596  /* Process messages without a channel and no chunking */
17597  size_t offset = 0;
17598  UA_TcpMessageHeader tcpMessageHeader;
17599  UA_StatusCode retval = UA_TcpMessageHeader_decodeBinary(message, &offset, &tcpMessageHeader);
17600  if(retval != UA_STATUSCODE_GOOD) {
17601  connection->close(connection);
17602  return;
17603  }
17604 
17605  /* Dispatch according to the message type */
17606  switch(tcpMessageHeader.messageTypeAndChunkType & 0x00ffffff) {
17607  case UA_MESSAGETYPE_ERR:
17608  UA_LOG_TRACE(server->config.logger, UA_LOGCATEGORY_NETWORK,
17609  "Connection %i | Process ERR message", connection->sockfd);
17610  processERR(server, connection, message, &offset);
17611  break;
17612  case UA_MESSAGETYPE_HEL:
17613  UA_LOG_TRACE(server->config.logger, UA_LOGCATEGORY_NETWORK,
17614  "Connection %i | Process HEL message", connection->sockfd);
17615  processHEL(connection, message, &offset);
17616  break;
17617  case UA_MESSAGETYPE_OPN: {
17618  UA_LOG_TRACE(server->config.logger, UA_LOGCATEGORY_NETWORK,
17619  "Connection %i | Process OPN message", connection->sockfd);
17620  UA_UInt32 channelId = 0;
17621  retval = UA_UInt32_decodeBinary(message, &offset, &channelId);
17622  if(retval != UA_STATUSCODE_GOOD)
17623  connection->close(connection);
17624  UA_ByteString offsetMessage = (UA_ByteString){
17625  .data = message->data + 12, .length = message->length - 12};
17626  processOPN(server, connection, channelId, &offsetMessage);
17627  break; }
17628  case UA_MESSAGETYPE_MSG:
17629  UA_LOG_TRACE(server->config.logger, UA_LOGCATEGORY_NETWORK,
17630  "Connection %i | Processing a MSG message not possible "
17631  "without a SecureChannel", connection->sockfd);
17632  connection->close(connection);
17633  break;
17634  case UA_MESSAGETYPE_CLO:
17635  UA_LOG_TRACE(server->config.logger, UA_LOGCATEGORY_NETWORK,
17636  "Connection %i | Processing a CLO message not possible "
17637  "without a SecureChannel", connection->sockfd);
17638  connection->close(connection);
17639  break;
17640  default:
17641  UA_LOG_TRACE(server->config.logger, UA_LOGCATEGORY_NETWORK,
17642  "Connection %i | Unknown message type", connection->sockfd);
17643  connection->close(connection);
17644  }
17645  }
17646 }
17647 
17648 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_server_utils.c" ***********************************/
17649 
17650 /* This Source Code Form is subject to the terms of the Mozilla Public
17651 * License, v. 2.0. If a copy of the MPL was not distributed with this
17652 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
17653 
17654 
17655 /**********************/
17656 /* Parse NumericRange */
17657 /**********************/
17658 
17659 static size_t
17660 readDimension(UA_Byte *buf, size_t buflen, UA_NumericRangeDimension *dim) {
17661  size_t progress = UA_readNumber(buf, buflen, &dim->min);
17662  if(progress == 0)
17663  return 0;
17664  if(buflen <= progress + 1 || buf[progress] != ':') {
17665  dim->max = dim->min;
17666  return progress;
17667  }
17668 
17669  ++progress;
17670  size_t progress2 = UA_readNumber(&buf[progress], buflen - progress, &dim->max);
17671  if(progress2 == 0)
17672  return 0;
17673 
17674  /* invalid range */
17675  if(dim->min >= dim->max)
17676  return 0;
17677 
17678  return progress + progress2;
17679 }
17680 
17683  size_t idx = 0;
17684  size_t dimensionsMax = 0;
17685  UA_NumericRangeDimension *dimensions = NULL;
17687  size_t offset = 0;
17688  while(true) {
17689  /* alloc dimensions */
17690  if(idx >= dimensionsMax) {
17691  UA_NumericRangeDimension *newds;
17692  size_t newdssize = sizeof(UA_NumericRangeDimension) * (dimensionsMax + 2);
17693  newds = UA_realloc(dimensions, newdssize);
17694  if(!newds) {
17696  break;
17697  }
17698  dimensions = newds;
17699  dimensionsMax = dimensionsMax + 2;
17700  }
17701 
17702  /* read the dimension */
17703  size_t progress = readDimension(&str->data[offset], str->length - offset,
17704  &dimensions[idx]);
17705  if(progress == 0) {
17707  break;
17708  }
17709  offset += progress;
17710  ++idx;
17711 
17712  /* loop into the next dimension */
17713  if(offset >= str->length)
17714  break;
17715 
17716  if(str->data[offset] != ',') {
17718  break;
17719  }
17720  ++offset;
17721  }
17722 
17723  if(retval == UA_STATUSCODE_GOOD && idx > 0) {
17724  range->dimensions = dimensions;
17725  range->dimensionsSize = idx;
17726  } else
17727  UA_free(dimensions);
17728 
17729  return retval;
17730 }
17731 
17732 /********************************/
17733 /* Information Model Operations */
17734 /********************************/
17735 
17737 getTypeHierarchy(UA_NodeStore *ns, const UA_Node *rootRef, UA_Boolean inverse,
17738  UA_NodeId **typeHierarchy, size_t *typeHierarchySize) {
17739  size_t results_size = 20; // probably too big, but saves mallocs
17740  UA_NodeId *results = UA_malloc(sizeof(UA_NodeId) * results_size);
17741  if(!results)
17743 
17744  UA_StatusCode retval = UA_NodeId_copy(&rootRef->nodeId, &results[0]);
17745  if(retval != UA_STATUSCODE_GOOD) {
17746  UA_free(results);
17747  return retval;
17748  }
17749 
17750  const UA_Node *node = rootRef;
17751  size_t idx = 0; /* Current index (contains NodeId of node) */
17752  size_t last = 0; /* Index of the last element in the array */
17753  const UA_NodeId hasSubtypeNodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_HASSUBTYPE);
17754  while(true) {
17755  for(size_t i = 0; i < node->referencesSize; ++i) {
17756  /* is the reference relevant? */
17757  if(node->references[i].isInverse != inverse ||
17758  !UA_NodeId_equal(&hasSubtypeNodeId, &node->references[i].referenceTypeId))
17759  continue;
17760 
17761  /* is the target already considered? (multi-inheritance) */
17762  UA_Boolean duplicate = false;
17763  for(size_t j = 0; j <= last; ++j) {
17764  if(UA_NodeId_equal(&node->references[i].targetId.nodeId, &results[j])) {
17765  duplicate = true;
17766  break;
17767  }
17768  }
17769  if(duplicate)
17770  continue;
17771 
17772  /* increase array length if necessary */
17773  if(last + 1 >= results_size) {
17774  UA_NodeId *new_results =
17775  UA_realloc(results, sizeof(UA_NodeId) * results_size * 2);
17776  if(!new_results) {
17778  break;
17779  }
17780  results = new_results;
17781  results_size *= 2;
17782  }
17783 
17784  /* copy new nodeid to the end of the list */
17785  retval = UA_NodeId_copy(&node->references[i].targetId.nodeId, &results[++last]);
17786  if(retval != UA_STATUSCODE_GOOD)
17787  break;
17788  }
17789 
17790  /* Get the next node */
17791  next:
17792  ++idx;
17793  if(idx > last || retval != UA_STATUSCODE_GOOD)
17794  break;
17795  node = UA_NodeStore_get(ns, &results[idx]);
17796  if(!node || node->nodeClass != rootRef->nodeClass)
17797  goto next;
17798  }
17799 
17800  if(retval != UA_STATUSCODE_GOOD) {
17801  UA_Array_delete(results, last, &UA_TYPES[UA_TYPES_NODEID]);
17802  return retval;
17803  }
17804 
17805  *typeHierarchy = results;
17806  *typeHierarchySize = last + 1;
17807  return UA_STATUSCODE_GOOD;
17808 }
17809 
17810 UA_Boolean
17811 isNodeInTree(UA_NodeStore *ns, const UA_NodeId *leafNode, const UA_NodeId *nodeToFind,
17812  const UA_NodeId *referenceTypeIds, size_t referenceTypeIdsSize) {
17813  if(UA_NodeId_equal(leafNode, nodeToFind))
17814  return true;
17815 
17816  const UA_Node *node = UA_NodeStore_get(ns,leafNode);
17817  if(!node)
17818  return false;
17819 
17820  /* Search upwards in the tree */
17821  for(size_t i = 0; i < node->referencesSize; ++i) {
17822  if(!node->references[i].isInverse)
17823  continue;
17824 
17825  /* Recurse only for valid reference types */
17826  for(size_t j = 0; j < referenceTypeIdsSize; ++j) {
17827  if(UA_NodeId_equal(&node->references[i].referenceTypeId, &referenceTypeIds[j]) &&
17828  isNodeInTree(ns, &node->references[i].targetId.nodeId, nodeToFind,
17829  referenceTypeIds, referenceTypeIdsSize))
17830  return true;
17831  }
17832  }
17833  return false;
17834 }
17835 
17836 const UA_Node *
17837 getNodeType(UA_Server *server, const UA_Node *node) {
17838  /* The reference to the parent is different for variable and variabletype */
17839  UA_NodeId parentRef;
17840  UA_Boolean inverse;
17841  if(node->nodeClass == UA_NODECLASS_VARIABLE ||
17842  node->nodeClass == UA_NODECLASS_OBJECT) {
17843  parentRef = UA_NODEID_NUMERIC(0, UA_NS0ID_HASTYPEDEFINITION);
17844  inverse = false;
17845  } else if(node->nodeClass == UA_NODECLASS_VARIABLETYPE ||
17846  /* node->nodeClass == UA_NODECLASS_OBJECTTYPE || // objecttype may have multiple parents */
17847  node->nodeClass == UA_NODECLASS_REFERENCETYPE ||
17848  node->nodeClass == UA_NODECLASS_DATATYPE) {
17849  parentRef = UA_NODEID_NUMERIC(0, UA_NS0ID_HASSUBTYPE);
17850  inverse = true;
17851  } else {
17852  return NULL;
17853  }
17854 
17855  /* stop at the first matching candidate */
17856  UA_NodeId *parentId = NULL;
17857  for(size_t i = 0; i < node->referencesSize; ++i) {
17858  if(node->references[i].isInverse == inverse &&
17859  UA_NodeId_equal(&node->references[i].referenceTypeId, &parentRef)) {
17860  parentId = &node->references[i].targetId.nodeId;
17861  break;
17862  }
17863  }
17864 
17865  if(!parentId)
17866  return NULL;
17867  return UA_NodeStore_get(server->nodestore, parentId);
17868 }
17869 
17870 const UA_VariableTypeNode *
17871 getVariableNodeType(UA_Server *server, const UA_VariableNode *node) {
17872  const UA_Node *type = getNodeType(server, (const UA_Node*)node);
17873  if(!type || type->nodeClass != UA_NODECLASS_VARIABLETYPE)
17874  return NULL;
17875  return (const UA_VariableTypeNode*)type;
17876 }
17877 
17878 const UA_ObjectTypeNode *
17879 getObjectNodeType(UA_Server *server, const UA_ObjectNode *node) {
17880  const UA_Node *type = getNodeType(server, (const UA_Node*)node);
17881  if(type->nodeClass != UA_NODECLASS_OBJECTTYPE)
17882  return NULL;
17883  return (const UA_ObjectTypeNode*)type;
17884 }
17885 
17886 UA_Boolean
17887 UA_Node_hasSubTypeOrInstances(const UA_Node *node) {
17888  const UA_NodeId hasSubType = UA_NODEID_NUMERIC(0, UA_NS0ID_HASSUBTYPE);
17889  const UA_NodeId hasTypeDefinition = UA_NODEID_NUMERIC(0, UA_NS0ID_HASTYPEDEFINITION);
17890  for(size_t i = 0; i < node->referencesSize; ++i) {
17891  if(node->references[i].isInverse == false &&
17892  UA_NodeId_equal(&node->references[i].referenceTypeId, &hasSubType))
17893  return true;
17894  if(node->references[i].isInverse == true &&
17895  UA_NodeId_equal(&node->references[i].referenceTypeId, &hasTypeDefinition))
17896  return true;
17897  }
17898  return false;
17899 }
17900 
17901 /* For mulithreading: make a copy of the node, edit and replace.
17902  * For singletrheading: edit the original */
17904 UA_Server_editNode(UA_Server *server, UA_Session *session,
17905  const UA_NodeId *nodeId, UA_EditNodeCallback callback,
17906  const void *data) {
17907 #ifndef UA_ENABLE_MULTITHREADING
17908  const UA_Node *node = UA_NodeStore_get(server->nodestore, nodeId);
17909  if(!node)
17911  UA_Node *editNode = (UA_Node*)(uintptr_t)node; // dirty cast
17912  return callback(server, session, editNode, data);
17913 #else
17914  UA_StatusCode retval;
17915  do {
17916  UA_Node *copy = UA_NodeStore_getCopy(server->nodestore, nodeId);
17917  if(!copy)
17919  retval = callback(server, session, copy, data);
17920  if(retval != UA_STATUSCODE_GOOD) {
17922  return retval;
17923  }
17924  retval = UA_NodeStore_replace(server->nodestore, copy);
17925  } while(retval != UA_STATUSCODE_GOOD);
17926  return UA_STATUSCODE_GOOD;
17927 #endif
17928 }
17929 
17930 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_server_worker.c" ***********************************/
17931 
17932 /* This Source Code Form is subject to the terms of the Mozilla Public
17933 * License, v. 2.0. If a copy of the MPL was not distributed with this
17934 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
17935 
17936 
17972 #define MAXTIMEOUT 50 // max timeout in millisec until the next main loop iteration
17973 
17974 static void
17975 processJob(UA_Server *server, UA_Job *job) {
17977  UA_RCU_LOCK();
17978  switch(job->type) {
17979  case UA_JOBTYPE_NOTHING:
17980  break;
17981  case UA_JOBTYPE_DETACHCONNECTION:
17983  break;
17984  case UA_JOBTYPE_BINARYMESSAGE_NETWORKLAYER:
17985  UA_Server_processBinaryMessage(server, job->job.binaryMessage.connection,
17986  &job->job.binaryMessage.message);
17987  UA_Connection *connection = job->job.binaryMessage.connection;
17988  connection->releaseRecvBuffer(connection, &job->job.binaryMessage.message);
17989  break;
17990  case UA_JOBTYPE_BINARYMESSAGE_ALLOCATED:
17991  UA_Server_processBinaryMessage(server, job->job.binaryMessage.connection,
17992  &job->job.binaryMessage.message);
17993  UA_ByteString_deleteMembers(&job->job.binaryMessage.message);
17994  break;
17995  case UA_JOBTYPE_METHODCALL:
17996  case UA_JOBTYPE_METHODCALL_DELAYED:
17997  job->job.methodCall.method(server, job->job.methodCall.data);
17998  break;
17999  default:
18000  UA_LOG_WARNING(server->config.logger, UA_LOGCATEGORY_SERVER,
18001  "Trying to execute a job of unknown type");
18002  break;
18003  }
18004  UA_RCU_UNLOCK();
18005 }
18006 
18007 /*******************************/
18008 /* Worker Threads and Dispatch */
18009 /*******************************/
18010 
18011 #ifdef UA_ENABLE_MULTITHREADING
18012 
18013 struct MainLoopJob {
18014  struct cds_lfs_node node;
18015  UA_Job job;
18016 };
18017 
18018 struct DispatchJob {
18019  struct cds_wfcq_node node; // node for the queue
18020  UA_Job job;
18021 };
18022 
18023 static void *
18024 workerLoop(UA_Worker *worker) {
18025  UA_Server *server = worker->server;
18026  UA_UInt32 *counter = &worker->counter;
18027  volatile UA_Boolean *running = &worker->running;
18028 
18029  /* Initialize the (thread local) random seed with the ram address of worker */
18030  UA_random_seed((uintptr_t)worker);
18031  rcu_register_thread();
18032 
18033  while(*running) {
18034  struct DispatchJob *dj = (struct DispatchJob*)
18035  cds_wfcq_dequeue_blocking(&server->dispatchQueue_head, &server->dispatchQueue_tail);
18036  if(dj) {
18037  processJob(server, &dj->job);
18038  UA_free(dj);
18039  } else {
18040  /* nothing to do. sleep until a job is dispatched (and wakes up all worker threads) */
18041  pthread_mutex_lock(&server->dispatchQueue_mutex);
18042  pthread_cond_wait(&server->dispatchQueue_condition, &server->dispatchQueue_mutex);
18043  pthread_mutex_unlock(&server->dispatchQueue_mutex);
18044  }
18045  UA_atomic_add(counter, 1);
18046  }
18047 
18049  rcu_barrier(); // wait for all scheduled call_rcu work to complete
18050  rcu_unregister_thread();
18051  UA_LOG_DEBUG(server->config.logger, UA_LOGCATEGORY_SERVER, "Worker shut down");
18052  return NULL;
18053 }
18054 
18055 static void
18056 dispatchJob(UA_Server *server, const UA_Job *job) {
18057  struct DispatchJob *dj = UA_malloc(sizeof(struct DispatchJob));
18058  dj->job = *job;
18059  cds_wfcq_node_init(&dj->node);
18060  cds_wfcq_enqueue(&server->dispatchQueue_head, &server->dispatchQueue_tail, &dj->node);
18061 }
18062 
18063 static void
18064 emptyDispatchQueue(UA_Server *server) {
18065  while(!cds_wfcq_empty(&server->dispatchQueue_head, &server->dispatchQueue_tail)) {
18066  struct DispatchJob *dj = (struct DispatchJob*)
18067  cds_wfcq_dequeue_blocking(&server->dispatchQueue_head, &server->dispatchQueue_tail);
18068  processJob(server, &dj->job);
18069  UA_free(dj);
18070  }
18071 }
18072 
18073 #endif
18074 
18075 /*****************/
18076 /* Repeated Jobs */
18077 /*****************/
18078 
18079 /* The linked list of jobs is sorted according to the next execution timestamp */
18080 struct RepeatedJob {
18081  LIST_ENTRY(RepeatedJob) next; /* Next element in the list */
18082  UA_DateTime nextTime; /* The next time when the jobs are to be executed */
18083  UA_UInt64 interval; /* Interval in 100ns resolution */
18084  UA_Guid id; /* Id of the repeated job */
18085  UA_Job job; /* The job description itself */
18086 };
18087 
18088 /* internal. call only from the main loop. */
18089 static void
18090 addRepeatedJob(UA_Server *server, struct RepeatedJob * UA_RESTRICT rj) {
18091  /* Search for the best position on the repeatedJobs sorted list. The goal is
18092  * to have many repeated jobs with the same repetition interval in a
18093  * "block". This helps to reduce the (linear) search to find the next entry
18094  * in the repeatedJobs list when dispatching the repeated jobs.
18095  * For this, we search between "nexttime_max - 1s" and "nexttime_max" for
18096  * entries with the same repetition interval and adjust the "nexttime".
18097  * Otherwise, add entry after the first element before "nexttime_max". */
18098  UA_DateTime nextTime_max = UA_DateTime_nowMonotonic() + (UA_Int64) rj->interval;
18099 
18100  struct RepeatedJob *afterRj = NULL;
18101  struct RepeatedJob *tmpRj;
18102  LIST_FOREACH(tmpRj, &server->repeatedJobs, next) {
18103  if(tmpRj->nextTime >= nextTime_max)
18104  break;
18105  if(tmpRj->interval == rj->interval &&
18106  tmpRj->nextTime > (nextTime_max - UA_SEC_TO_DATETIME))
18107  nextTime_max = tmpRj->nextTime; /* break in the next iteration */
18108  afterRj = tmpRj;
18109  }
18110 
18111  /* add the repeated job */
18112  rj->nextTime = nextTime_max;
18113  if(afterRj)
18114  LIST_INSERT_AFTER(afterRj, rj, next);
18115  else
18116  LIST_INSERT_HEAD(&server->repeatedJobs, rj, next);
18117 }
18118 
18120 UA_Server_addRepeatedJob(UA_Server *server, UA_Job job,
18121  UA_UInt32 interval, UA_Guid *jobId) {
18122  /* the interval needs to be at least 5ms */
18123  if(interval < 5)
18125  UA_UInt64 interval_dt =
18126  (UA_UInt64)interval * (UA_UInt64)UA_MSEC_TO_DATETIME; // from ms to 100ns resolution
18127 
18128  /* Create and fill the repeated job structure */
18129  struct RepeatedJob *rj = UA_malloc(sizeof(struct RepeatedJob));
18130  if(!rj)
18132  /* done inside addRepeatedJob:
18133  * rj->nextTime = UA_DateTime_nowMonotonic() + interval_dt; */
18134  rj->interval = interval_dt;
18135  rj->id = UA_Guid_random();
18136  rj->job = job;
18137 
18138 #ifdef UA_ENABLE_MULTITHREADING
18139  /* Call addRepeatedJob from the main loop */
18140  struct MainLoopJob *mlw = UA_malloc(sizeof(struct MainLoopJob));
18141  if(!mlw) {
18142  UA_free(rj);
18144  }
18145  mlw->job = (UA_Job) {
18146  .type = UA_JOBTYPE_METHODCALL,
18147  .job.methodCall = {.data = rj, .method = (void (*)(UA_Server*, void*))addRepeatedJob}};
18148  cds_lfs_push(&server->mainLoopJobs, &mlw->node);
18149 #else
18150  /* Add directly */
18151  addRepeatedJob(server, rj);
18152 #endif
18153  if(jobId)
18154  *jobId = rj->id;
18155  return UA_STATUSCODE_GOOD;
18156 }
18157 
18158 /* - Dispatches all repeated jobs that have timed out
18159  * - Reinserts dispatched job at their new position in the sorted list
18160  * - Returns the next datetime when a repeated job is scheduled */
18161 static UA_DateTime
18162 processRepeatedJobs(UA_Server *server, UA_DateTime current, UA_Boolean *dispatched) {
18163  /* Keep pointer to the previously dispatched job to avoid linear search for
18164  * "batched" jobs with the same nexttime and interval */
18165  struct RepeatedJob tmp_last;
18166  tmp_last.nextTime = current-1; /* never matches. just to avoid if(last_added && ...) */
18167  struct RepeatedJob *last_dispatched = &tmp_last;
18168 
18169  /* Iterate over the list of elements (sorted according to the nextTime timestamp) */
18170  struct RepeatedJob *rj, *tmp_rj;
18171  LIST_FOREACH_SAFE(rj, &server->repeatedJobs, next, tmp_rj) {
18172  if(rj->nextTime > current)
18173  break;
18174 
18175  /* Dispatch/process job */
18176 #ifdef UA_ENABLE_MULTITHREADING
18177  dispatchJob(server, &rj->job);
18178  *dispatched = true;
18179 #else
18180  struct RepeatedJob **previousNext = rj->next.le_prev;
18181  processJob(server, &rj->job);
18182  /* See if the current job was deleted during processJob. That means the
18183  * le_next field of the previous repeated job (could also be the list
18184  * head) does no longer point to the current repeated job */
18185  if((void*)*previousNext != (void*)rj) {
18186  UA_LOG_DEBUG(server->config.logger, UA_LOGCATEGORY_SERVER,
18187  "The current repeated job removed itself");
18188  tmp_rj = LIST_FIRST(&server->repeatedJobs);
18189  continue;
18190  }
18191 
18192  /* Was tmp_rj removed during the job? */
18193  if(LIST_NEXT(rj, next) != tmp_rj)
18194  tmp_rj = LIST_FIRST(&server->repeatedJobs);
18195 #endif
18196 
18197  /* Set the time for the next execution */
18198  rj->nextTime += (UA_Int64)rj->interval;
18199 
18200  /* Prevent an infinite loop when the repeated jobs took more time than
18201  * rj->interval */
18202  if(rj->nextTime < current)
18203  rj->nextTime = current + 1;
18204 
18205  /* Find new position for rj to keep the list sorted */
18206  struct RepeatedJob *prev_rj;
18207  if(last_dispatched->nextTime == rj->nextTime) {
18208  /* We "batch" repeatedJobs with the same interval in
18209  * addRepeatedJobs. So this might occur quite often. */
18210  UA_assert(last_dispatched != &tmp_last);
18211  prev_rj = last_dispatched;
18212  } else {
18213  /* Find the position by a linear search */
18214  prev_rj = LIST_FIRST(&server->repeatedJobs);
18215  while(true) {
18216  struct RepeatedJob *n = LIST_NEXT(prev_rj, next);
18217  if(!n || n->nextTime >= rj->nextTime)
18218  break;
18219  prev_rj = n;
18220  }
18221  }
18222 
18223  /* Add entry */
18224  if(prev_rj != rj) {
18225  LIST_REMOVE(rj, next);
18226  LIST_INSERT_AFTER(prev_rj, rj, next);
18227  }
18228 
18229  /* Update last_dispatched and loop */
18230  last_dispatched = rj;
18231  }
18232 
18233  /* Check if the next repeated job is sooner than the usual timeout */
18234  struct RepeatedJob *first = LIST_FIRST(&server->repeatedJobs);
18235  UA_DateTime next = current + (MAXTIMEOUT * UA_MSEC_TO_DATETIME);
18236  if(first && first->nextTime < next)
18237  next = first->nextTime;
18238  return next;
18239 }
18240 
18241 /* Call this function only from the main loop! */
18242 static void
18243 removeRepeatedJob(UA_Server *server, UA_Guid *jobId) {
18244  struct RepeatedJob *rj, *rj_tmp;
18245  LIST_FOREACH_SAFE(rj, &server->repeatedJobs, next, rj_tmp) {
18246  if(!UA_Guid_equal(jobId, &rj->id))
18247  continue;
18248  LIST_REMOVE(rj, next);
18249  UA_free(rj);
18250  break;
18251  }
18252 #ifdef UA_ENABLE_MULTITHREADING
18253  UA_free(jobId);
18254 #endif
18255 }
18256 
18258 #ifdef UA_ENABLE_MULTITHREADING
18259  UA_Guid *idptr = UA_malloc(sizeof(UA_Guid));
18260  if(!idptr)
18262  *idptr = jobId;
18263  // dispatch to the mainloopjobs stack
18264  struct MainLoopJob *mlw = UA_malloc(sizeof(struct MainLoopJob));
18265  mlw->job = (UA_Job) {
18266  .type = UA_JOBTYPE_METHODCALL,
18267  .job.methodCall = {.data = idptr, .method = (void (*)(UA_Server*, void*))removeRepeatedJob}};
18268  cds_lfs_push(&server->mainLoopJobs, &mlw->node);
18269 #else
18270  removeRepeatedJob(server, &jobId);
18271 #endif
18272  return UA_STATUSCODE_GOOD;
18273 }
18274 
18275 void UA_Server_deleteAllRepeatedJobs(UA_Server *server) {
18276  struct RepeatedJob *current, *temp;
18277  LIST_FOREACH_SAFE(current, &server->repeatedJobs, next, temp) {
18278  LIST_REMOVE(current, next);
18279  UA_free(current);
18280  }
18281 }
18282 
18283 /****************/
18284 /* Delayed Jobs */
18285 /****************/
18286 
18287 static void
18288 delayed_free(UA_Server *server, void *data) {
18289  UA_free(data);
18290 }
18291 
18292 UA_StatusCode UA_Server_delayedFree(UA_Server *server, void *data) {
18293  return UA_Server_delayedCallback(server, delayed_free, data);
18294 }
18295 
18296 #ifndef UA_ENABLE_MULTITHREADING
18297 
18298 typedef struct UA_DelayedJob {
18299  SLIST_ENTRY(UA_DelayedJob) next;
18300  UA_Job job;
18301 } UA_DelayedJob;
18302 
18304 UA_Server_delayedCallback(UA_Server *server, UA_ServerCallback callback, void *data) {
18305  UA_DelayedJob *dj = UA_malloc(sizeof(UA_DelayedJob));
18306  if(!dj)
18308  dj->job.type = UA_JOBTYPE_METHODCALL;
18309  dj->job.job.methodCall.data = data;
18310  dj->job.job.methodCall.method = callback;
18311  SLIST_INSERT_HEAD(&server->delayedCallbacks, dj, next);
18312  return UA_STATUSCODE_GOOD;
18313 }
18314 
18315 static void
18316 processDelayedCallbacks(UA_Server *server) {
18317  UA_DelayedJob *dj, *dj_tmp;
18318  SLIST_FOREACH_SAFE(dj, &server->delayedCallbacks, next, dj_tmp) {
18319  SLIST_REMOVE(&server->delayedCallbacks, dj, UA_DelayedJob, next);
18320  processJob(server, &dj->job);
18321  UA_free(dj);
18322  }
18323 }
18324 
18325 #else
18326 
18327 #define DELAYEDJOBSSIZE 100 // Collect delayed jobs until we have DELAYEDWORKSIZE items
18328 
18329 struct DelayedJobs {
18330  struct DelayedJobs *next;
18331  UA_UInt32 *workerCounters; // initially NULL until the counter are set
18332  UA_UInt32 jobsCount; // the size of the array is DELAYEDJOBSSIZE, the count may be less
18333  UA_Job jobs[DELAYEDJOBSSIZE]; // when it runs full, a new delayedJobs entry is created
18334 };
18335 
18336 /* Dispatched as an ordinary job when the DelayedJobs list is full */
18337 static void getCounters(UA_Server *server, struct DelayedJobs *delayed) {
18338  UA_UInt32 *counters = UA_malloc(server->config.nThreads * sizeof(UA_UInt32));
18339  for(UA_UInt16 i = 0; i < server->config.nThreads; ++i)
18340  counters[i] = server->workers[i].counter;
18341  delayed->workerCounters = counters;
18342 }
18343 
18344 /* Call from the main thread only. This is the only function that modifies */
18345 /* server->delayedWork. processDelayedWorkQueue modifies the "next" (after the */
18346 /* head). */
18347 static void
18348 addDelayedJob(UA_Server *server, UA_Job *job) {
18349  struct DelayedJobs *dj = server->delayedJobs;
18350  if(!dj || dj->jobsCount >= DELAYEDJOBSSIZE) {
18351  /* create a new DelayedJobs and add it to the linked list */
18352  dj = UA_malloc(sizeof(struct DelayedJobs));
18353  if(!dj) {
18354  UA_LOG_ERROR(server->config.logger, UA_LOGCATEGORY_SERVER,
18355  "Not enough memory to add a delayed job");
18356  return;
18357  }
18358  dj->jobsCount = 0;
18359  dj->workerCounters = NULL;
18360  dj->next = server->delayedJobs;
18361  server->delayedJobs = dj;
18362 
18363  /* dispatch a method that sets the counter for the full list that comes afterwards */
18364  if(dj->next) {
18365  UA_Job setCounter = (UA_Job){
18366  .type = UA_JOBTYPE_METHODCALL, .job.methodCall =
18367  {.method = (void (*)(UA_Server*, void*))getCounters, .data = dj->next}};
18368  dispatchJob(server, &setCounter);
18369  }
18370  }
18371  dj->jobs[dj->jobsCount] = *job;
18372  ++dj->jobsCount;
18373 }
18374 
18375 static void
18376 addDelayedJobAsync(UA_Server *server, UA_Job *job) {
18377  addDelayedJob(server, job);
18378  UA_free(job);
18379 }
18380 
18382 UA_Server_delayedCallback(UA_Server *server, UA_ServerCallback callback, void *data) {
18383  UA_Job *j = UA_malloc(sizeof(UA_Job));
18384  if(!j)
18386  j->type = UA_JOBTYPE_METHODCALL;
18387  j->job.methodCall.data = data;
18388  j->job.methodCall.method = callback;
18389  struct MainLoopJob *mlw = UA_malloc(sizeof(struct MainLoopJob));
18390  mlw->job = (UA_Job) {.type = UA_JOBTYPE_METHODCALL, .job.methodCall =
18391  {.data = j, .method = (UA_ServerCallback)addDelayedJobAsync}};
18392  cds_lfs_push(&server->mainLoopJobs, &mlw->node);
18393  return UA_STATUSCODE_GOOD;
18394 }
18395 
18396 /* Find out which delayed jobs can be executed now */
18397 static void
18398 dispatchDelayedJobs(UA_Server *server, void *_) {
18399  /* start at the second */
18400  struct DelayedJobs *dw = server->delayedJobs, *beforedw = dw;
18401  if(dw)
18402  dw = dw->next;
18403 
18404  /* find the first delayedwork where the counters have been set and have moved */
18405  while(dw) {
18406  if(!dw->workerCounters) {
18407  beforedw = dw;
18408  dw = dw->next;
18409  continue;
18410  }
18411  UA_Boolean allMoved = true;
18412  for(size_t i = 0; i < server->config.nThreads; ++i) {
18413  if(dw->workerCounters[i] == server->workers[i].counter) {
18414  allMoved = false;
18415  break;
18416  }
18417  }
18418  if(allMoved)
18419  break;
18420  beforedw = dw;
18421  dw = dw->next;
18422  }
18423 
18424  /* process and free all delayed jobs from here on */
18425  while(dw) {
18426  for(size_t i = 0; i < dw->jobsCount; ++i)
18427  processJob(server, &dw->jobs[i]);
18428  struct DelayedJobs *next = UA_atomic_xchg((void**)&beforedw->next, NULL);
18429  UA_free(dw->workerCounters);
18430  UA_free(dw);
18431  dw = next;
18432  }
18433 }
18434 
18435 #endif
18436 
18437 /********************/
18438 /* Main Server Loop */
18439 /********************/
18440 
18441 #ifdef UA_ENABLE_MULTITHREADING
18442 static void processMainLoopJobs(UA_Server *server) {
18443  /* no synchronization required if we only use push and pop_all */
18444  struct cds_lfs_head *head = __cds_lfs_pop_all(&server->mainLoopJobs);
18445  if(!head)
18446  return;
18447  struct MainLoopJob *mlw = (struct MainLoopJob*)&head->node;
18448  struct MainLoopJob *next;
18449  do {
18450  processJob(server, &mlw->job);
18451  next = (struct MainLoopJob*)mlw->node.next;
18452  UA_free(mlw);
18453  //cppcheck-suppress unreadVariable
18454  } while((mlw = next));
18455 }
18456 #endif
18457 
18459 #ifdef UA_ENABLE_MULTITHREADING
18460  /* Spin up the worker threads */
18461  UA_LOG_INFO(server->config.logger, UA_LOGCATEGORY_SERVER,
18462  "Spinning up %u worker thread(s)", server->config.nThreads);
18463  pthread_cond_init(&server->dispatchQueue_condition, 0);
18464  pthread_mutex_init(&server->dispatchQueue_mutex, 0);
18465  server->workers = UA_malloc(server->config.nThreads * sizeof(UA_Worker));
18466  if(!server->workers)
18468  for(size_t i = 0; i < server->config.nThreads; ++i) {
18469  UA_Worker *worker = &server->workers[i];
18470  worker->server = server;
18471  worker->counter = 0;
18472  worker->running = true;
18473  pthread_create(&worker->thr, NULL, (void* (*)(void*))workerLoop, worker);
18474  }
18475 
18476  /* Try to execute delayed callbacks every 10 sec */
18477  UA_Job processDelayed = {.type = UA_JOBTYPE_METHODCALL,
18478  .job.methodCall = {.method = dispatchDelayedJobs, .data = NULL} };
18479  UA_Server_addRepeatedJob(server, processDelayed, 10000, NULL);
18480 #endif
18481 
18482  /* Start the networklayers */
18484  for(size_t i = 0; i < server->config.networkLayersSize; ++i) {
18485  UA_ServerNetworkLayer *nl = &server->config.networkLayers[i];
18486  result |= nl->start(nl, server->config.logger);
18487  }
18488 
18489  return result;
18490 }
18491 
18492 /* completeMessages is run synchronous on the jobs returned from the network
18493  layer, so that the order for processing TCP packets is never mixed up. */
18494 static void
18495 completeMessages(UA_Server *server, UA_Job *job) {
18496  UA_Boolean realloced = UA_FALSE;
18498  &job->job.binaryMessage.message, &realloced);
18499  if(retval != UA_STATUSCODE_GOOD) {
18500  if(retval == UA_STATUSCODE_BADOUTOFMEMORY)
18501  UA_LOG_WARNING(server->config.logger, UA_LOGCATEGORY_NETWORK,
18502  "Lost message(s) from Connection %i as memory could not be allocated",
18503  job->job.binaryMessage.connection->sockfd);
18504  else if(retval != UA_STATUSCODE_GOOD)
18505  UA_LOG_INFO(server->config.logger, UA_LOGCATEGORY_NETWORK,
18506  "Could not merge half-received messages on Connection %i with error 0x%08x",
18507  job->job.binaryMessage.connection->sockfd, retval);
18508  job->type = UA_JOBTYPE_NOTHING;
18509  return;
18510  }
18511  if(realloced)
18512  job->type = UA_JOBTYPE_BINARYMESSAGE_ALLOCATED;
18513 
18514  /* discard the job if message is empty - also no leak is possible here */
18515  if(job->job.binaryMessage.message.length == 0)
18516  job->type = UA_JOBTYPE_NOTHING;
18517 }
18518 
18519 UA_UInt16 UA_Server_run_iterate(UA_Server *server, UA_Boolean waitInternal) {
18520 #ifdef UA_ENABLE_MULTITHREADING
18521  /* Run work assigned for the main thread */
18522  processMainLoopJobs(server);
18523 #endif
18524  /* Process repeated work */
18526  UA_Boolean dispatched = false; /* to wake up worker threads */
18527  UA_DateTime nextRepeated = processRepeatedJobs(server, now, &dispatched);
18528 
18529  UA_UInt16 timeout = 0;
18530  if(waitInternal)
18531  timeout = (UA_UInt16)((nextRepeated - now) / UA_MSEC_TO_DATETIME);
18532 
18533  /* Get work from the networklayer */
18534  for(size_t i = 0; i < server->config.networkLayersSize; ++i) {
18535  UA_ServerNetworkLayer *nl = &server->config.networkLayers[i];
18536  UA_Job *jobs = NULL;
18537  size_t jobsSize;
18538  /* only the last networklayer waits on the tieout */
18539  if(i == server->config.networkLayersSize-1)
18540  jobsSize = nl->getJobs(nl, &jobs, timeout);
18541  else
18542  jobsSize = nl->getJobs(nl, &jobs, 0);
18543 
18544  for(size_t k = 0; k < jobsSize; ++k) {
18545 #ifdef UA_ENABLE_MULTITHREADING
18546  /* Filter out delayed work */
18547  if(jobs[k].type == UA_JOBTYPE_METHODCALL_DELAYED) {
18548  addDelayedJob(server, &jobs[k]);
18549  jobs[k].type = UA_JOBTYPE_NOTHING;
18550  continue;
18551  }
18552 #endif
18553  /* Merge half-received messages */
18554  if(jobs[k].type == UA_JOBTYPE_BINARYMESSAGE_NETWORKLAYER)
18555  completeMessages(server, &jobs[k]);
18556  }
18557 
18558  /* Dispatch/process jobs */
18559  for(size_t j = 0; j < jobsSize; ++j) {
18560 #ifdef UA_ENABLE_MULTITHREADING
18561  dispatchJob(server, &jobs[j]);
18562  dispatched = true;
18563 #else
18564  processJob(server, &jobs[j]);
18565 #endif
18566  }
18567 
18568  /* Clean up jobs list */
18569  if(jobsSize > 0)
18570  UA_free(jobs);
18571  }
18572 
18573 #ifdef UA_ENABLE_MULTITHREADING
18574  /* Wake up worker threads */
18575  if(dispatched)
18576  pthread_cond_broadcast(&server->dispatchQueue_condition);
18577 #else
18578  processDelayedCallbacks(server);
18579 #endif
18580 
18581  now = UA_DateTime_nowMonotonic();
18582  timeout = 0;
18583  if(nextRepeated > now)
18584  timeout = (UA_UInt16)((nextRepeated - now) / UA_MSEC_TO_DATETIME);
18585  return timeout;
18586 }
18587 
18589  for(size_t i = 0; i < server->config.networkLayersSize; ++i) {
18590  UA_ServerNetworkLayer *nl = &server->config.networkLayers[i];
18591  UA_Job *stopJobs = NULL;
18592  size_t stopJobsSize = nl->stop(nl, &stopJobs);
18593  for(size_t j = 0; j < stopJobsSize; ++j)
18594  processJob(server, &stopJobs[j]);
18595  UA_free(stopJobs);
18596  }
18597 
18598 #ifdef UA_ENABLE_MULTITHREADING
18599  /* Ensure that run_shutdown can be called multiple times */
18600  if(server->workers) {
18601  UA_LOG_INFO(server->config.logger, UA_LOGCATEGORY_SERVER,
18602  "Shutting down %u worker thread(s)", server->config.nThreads);
18603  /* Wait for all worker threads to finish */
18604  for(size_t i = 0; i < server->config.nThreads; ++i)
18605  server->workers[i].running = false;
18606  pthread_cond_broadcast(&server->dispatchQueue_condition);
18607  for(size_t i = 0; i < server->config.nThreads; ++i)
18608  pthread_join(server->workers[i].thr, NULL);
18609  /* Free the worker structures */
18610  UA_free(server->workers);
18611  server->workers = NULL;
18612  }
18613 
18614  /* Manually finish the work still enqueued */
18615  emptyDispatchQueue(server);
18617  rcu_barrier(); // wait for all scheduled call_rcu work to complete
18618 #else
18619  processDelayedCallbacks(server);
18620 #endif
18621  return UA_STATUSCODE_GOOD;
18622 }
18623 
18624 UA_StatusCode UA_Server_run(UA_Server *server, volatile UA_Boolean *running) {
18625  UA_StatusCode retval = UA_Server_run_startup(server);
18626  if(retval != UA_STATUSCODE_GOOD)
18627  return retval;
18628  while(*running)
18629  UA_Server_run_iterate(server, true);
18630  return UA_Server_run_shutdown(server);
18631 }
18632 
18633 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_securechannel_manager.c" ***********************************/
18634 
18635 /* This Source Code Form is subject to the terms of the Mozilla Public
18636 * License, v. 2.0. If a copy of the MPL was not distributed with this
18637 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
18638 
18639 
18640 #define STARTCHANNELID 1
18641 #define STARTTOKENID 1
18642 
18645  LIST_INIT(&cm->channels);
18646  cm->lastChannelId = STARTCHANNELID;
18647  cm->lastTokenId = STARTTOKENID;
18648  cm->currentChannelCount = 0;
18649  cm->server = server;
18650  return UA_STATUSCODE_GOOD;
18651 }
18652 
18654  channel_list_entry *entry, *temp;
18655  LIST_FOREACH_SAFE(entry, &cm->channels, pointers, temp) {
18656  LIST_REMOVE(entry, pointers);
18658  UA_free(entry);
18659  }
18660 }
18661 
18662 static void
18663 removeSecureChannelCallback(UA_Server *server, void *entry) {
18664  channel_list_entry *centry = (channel_list_entry*)entry;
18666  UA_free(entry);
18667 }
18668 
18669 static UA_StatusCode
18670 removeSecureChannel(UA_SecureChannelManager *cm, channel_list_entry *entry){
18671  /* Add a delayed callback to remove the channel when the currently
18672  * scheduled jobs have completed */
18673  UA_StatusCode retval = UA_Server_delayedCallback(cm->server, removeSecureChannelCallback, entry);
18674  if(retval != UA_STATUSCODE_GOOD) {
18675  UA_LOG_WARNING(cm->server->config.logger, UA_LOGCATEGORY_SESSION,
18676  "Could not remove the secure channel with error code %s",
18677  UA_StatusCode_name(retval));
18678  return retval; /* Try again next time */
18679  }
18680 
18681  /* Detach the channel and make the capacity available */
18682  LIST_REMOVE(entry, pointers);
18683  UA_atomic_add(&cm->currentChannelCount, (UA_UInt32)-1);
18684  return UA_STATUSCODE_GOOD;
18685 }
18686 
18687 /* remove channels that were not renewed or who have no connection attached */
18688 void
18690  channel_list_entry *entry, *temp;
18691  LIST_FOREACH_SAFE(entry, &cm->channels, pointers, temp) {
18692  UA_DateTime timeout = entry->channel.securityToken.createdAt +
18694  if(timeout < nowMonotonic || !entry->channel.connection) {
18695  UA_LOG_INFO_CHANNEL(cm->server->config.logger, &entry->channel,
18696  "SecureChannel has timed out");
18697  removeSecureChannel(cm, entry);
18698  } else if(entry->channel.nextSecurityToken.tokenId > 0) {
18700  }
18701  }
18702 }
18703 
18704 /* remove the first channel that has no session attached */
18705 static UA_Boolean purgeFirstChannelWithoutSession(UA_SecureChannelManager *cm) {
18706  channel_list_entry *entry;
18707  LIST_FOREACH(entry, &cm->channels, pointers) {
18708  if(LIST_EMPTY(&(entry->channel.sessions))){
18709  UA_LOG_DEBUG_CHANNEL(cm->server->config.logger, &entry->channel,
18710  "Channel was purged since maxSecureChannels was "
18711  "reached and channel had no session attached");
18712  removeSecureChannel(cm, entry);
18713  UA_assert(entry != LIST_FIRST(&cm->channels));
18714  return true;
18715  }
18716  }
18717  return false;
18718 }
18719 
18722  const UA_OpenSecureChannelRequest *request,
18723  UA_OpenSecureChannelResponse *response) {
18726 
18727  //check if there exists a free SC, otherwise try to purge one SC without a session
18728  //the purge has been introduced to pass CTT, it is not clear what strategy is expected here
18729  if(cm->currentChannelCount >= cm->server->config.maxSecureChannels && !purgeFirstChannelWithoutSession(cm)){
18731  }
18732 
18733  /* Set up the channel */
18735  if(!entry)
18737  UA_SecureChannel_init(&entry->channel);
18738  entry->channel.securityToken.channelId = cm->lastChannelId++;
18739  entry->channel.securityToken.tokenId = cm->lastTokenId++;
18742  (request->requestedLifetime > cm->server->config.maxSecurityTokenLifetime) ?
18743  cm->server->config.maxSecurityTokenLifetime : request->requestedLifetime;
18744  if(entry->channel.securityToken.revisedLifetime == 0) /* lifetime 0 -> set the maximum possible */
18745  entry->channel.securityToken.revisedLifetime = cm->server->config.maxSecurityTokenLifetime;
18746  UA_ByteString_copy(&request->clientNonce, &entry->channel.clientNonce);
18748  UA_STRING_ALLOC("http://opcfoundation.org/UA/SecurityPolicy#None");
18750 
18751  /* Set the response */
18752  UA_ByteString_copy(&entry->channel.serverNonce, &response->serverNonce);
18753  UA_ChannelSecurityToken_copy(&entry->channel.securityToken, &response->securityToken);
18755 
18756  /* Now overwrite the creation date with the internal monotonic clock */
18758 
18759  /* Set all the pointers internally */
18761  LIST_INSERT_HEAD(&cm->channels, entry, pointers);
18762  UA_atomic_add(&cm->currentChannelCount, 1);
18763  return UA_STATUSCODE_GOOD;
18764 }
18765 
18768  const UA_OpenSecureChannelRequest *request,
18769  UA_OpenSecureChannelResponse *response) {
18770  UA_SecureChannel *channel = conn->channel;
18771  if(!channel)
18773 
18774  /* if no security token is already issued */
18775  if(channel->nextSecurityToken.tokenId == 0) {
18776  channel->nextSecurityToken.channelId = channel->securityToken.channelId;
18777  channel->nextSecurityToken.tokenId = cm->lastTokenId++;
18780  (request->requestedLifetime > cm->server->config.maxSecurityTokenLifetime) ?
18781  cm->server->config.maxSecurityTokenLifetime : request->requestedLifetime;
18782  if(channel->nextSecurityToken.revisedLifetime == 0) /* lifetime 0 -> return the max lifetime */
18783  channel->nextSecurityToken.revisedLifetime = cm->server->config.maxSecurityTokenLifetime;
18784  }
18785 
18786  /* invalidate the old nonce */
18787  if(channel->clientNonce.data)
18788  UA_ByteString_deleteMembers(&channel->clientNonce);
18789 
18790  /* set the response */
18791  UA_ByteString_copy(&request->clientNonce, &channel->clientNonce);
18792  UA_ByteString_copy(&channel->serverNonce, &response->serverNonce);
18793  UA_ChannelSecurityToken_copy(&channel->nextSecurityToken, &response->securityToken);
18794 
18795  /* reset the creation date to the monotonic clock */
18797 
18798  return UA_STATUSCODE_GOOD;
18799 }
18800 
18803  channel_list_entry *entry;
18804  LIST_FOREACH(entry, &cm->channels, pointers) {
18805  if(entry->channel.securityToken.channelId == channelId)
18806  return &entry->channel;
18807  }
18808  return NULL;
18809 }
18810 
18813  channel_list_entry *entry;
18814  LIST_FOREACH(entry, &cm->channels, pointers) {
18815  if(entry->channel.securityToken.channelId == channelId)
18816  break;
18817  }
18818  if(!entry)
18820  return removeSecureChannel(cm, entry);
18821 }
18822 
18823 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_session_manager.c" ***********************************/
18824 
18825 /* This Source Code Form is subject to the terms of the Mozilla Public
18826 * License, v. 2.0. If a copy of the MPL was not distributed with this
18827 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
18828 
18829 
18832  LIST_INIT(&sm->sessions);
18833  sm->currentSessionCount = 0;
18834  sm->server = server;
18835  return UA_STATUSCODE_GOOD;
18836 }
18837 
18839  session_list_entry *current, *temp;
18840  LIST_FOREACH_SAFE(current, &sm->sessions, pointers, temp) {
18841  LIST_REMOVE(current, pointers);
18842  UA_Session_deleteMembersCleanup(&current->session, sm->server);
18843  UA_free(current);
18844  }
18845 }
18846 
18847 /* Delayed callback to free the session memory */
18848 static void
18849 removeSessionCallback(UA_Server *server, void *entry) {
18850  session_list_entry *sentry = (session_list_entry*)entry;
18851  UA_Session_deleteMembersCleanup(&sentry->session, server);
18852  UA_free(sentry);
18853 }
18854 
18855 static UA_StatusCode
18856 removeSession(UA_SessionManager *sm, session_list_entry *sentry) {
18857  /* Deactivate the session */
18858  sentry->session.activated = false;
18859 
18860  /* Add a delayed callback to remove the session when the currently
18861  * scheduled jobs have completed */
18862  UA_StatusCode retval = UA_Server_delayedCallback(sm->server, removeSessionCallback, sentry);
18863  if(retval != UA_STATUSCODE_GOOD) {
18864  UA_LOG_WARNING_SESSION(sm->server->config.logger, &sentry->session,
18865  "Could not remove session with error code %s",
18866  UA_StatusCode_name(retval));
18867  return retval; /* Try again next time */
18868  }
18869 
18870  /* Detach the session and make the capacity available */
18871  LIST_REMOVE(sentry, pointers);
18872  UA_atomic_add(&sm->currentSessionCount, (UA_UInt32)-1);
18873  return UA_STATUSCODE_GOOD;
18874 }
18875 
18876 void
18878  UA_DateTime nowMonotonic) {
18879  session_list_entry *sentry, *temp;
18880  LIST_FOREACH_SAFE(sentry, &sm->sessions, pointers, temp) {
18881  /* Session has timed out? */
18882  if(sentry->session.validTill >= nowMonotonic)
18883  continue;
18884  UA_LOG_INFO_SESSION(sm->server->config.logger, &sentry->session,
18885  "Session has timed out");
18886  removeSession(sm, sentry);
18887  }
18888 }
18889 
18890 UA_Session *
18892  session_list_entry *current = NULL;
18893  LIST_FOREACH(current, &sm->sessions, pointers) {
18894  /* Token does not match */
18895  if(!UA_NodeId_equal(&current->session.authenticationToken, token))
18896  continue;
18897 
18898  /* Session has timed out */
18899  if(UA_DateTime_nowMonotonic() > current->session.validTill) {
18900  UA_LOG_INFO_SESSION(sm->server->config.logger, &current->session,
18901  "Client tries to use a session that has timed out");
18902  return NULL;
18903  }
18904 
18905  /* Ok, return */
18906  return &current->session;
18907  }
18908 
18909  /* Session not found */
18910  UA_LOG_INFO(sm->server->config.logger, UA_LOGCATEGORY_SESSION,
18911  "Try to use Session with token " UA_PRINTF_GUID_FORMAT " but is not found",
18913  return NULL;
18914 }
18915 
18916 /* Creates and adds a session. But it is not yet attached to a secure channel. */
18919  const UA_CreateSessionRequest *request, UA_Session **session) {
18920  if(sm->currentSessionCount >= sm->server->config.maxSessions)
18922 
18923  session_list_entry *newentry = UA_malloc(sizeof(session_list_entry));
18924  if(!newentry)
18926 
18927  UA_atomic_add(&sm->currentSessionCount, 1);
18928  UA_Session_init(&newentry->session);
18929  newentry->session.sessionId = UA_NODEID_GUID(1, UA_Guid_random());
18930  newentry->session.authenticationToken = UA_NODEID_GUID(1, UA_Guid_random());
18931 
18932  if(request->requestedSessionTimeout <= sm->server->config.maxSessionTimeout &&
18933  request->requestedSessionTimeout > 0)
18934  newentry->session.timeout = request->requestedSessionTimeout;
18935  else
18936  newentry->session.timeout = sm->server->config.maxSessionTimeout;
18937 
18938  UA_Session_updateLifetime(&newentry->session);
18939  LIST_INSERT_HEAD(&sm->sessions, newentry, pointers);
18940  *session = &newentry->session;
18941  return UA_STATUSCODE_GOOD;
18942 }
18943 
18946  session_list_entry *current;
18947  LIST_FOREACH(current, &sm->sessions, pointers) {
18948  if(UA_NodeId_equal(&current->session.authenticationToken, token))
18949  break;
18950  }
18951  if(!current)
18953  return removeSession(sm, current);
18954 }
18955 
18956 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_nodes.c" ***********************************/
18957 
18958 /* This Source Code Form is subject to the terms of the Mozilla Public
18959 * License, v. 2.0. If a copy of the MPL was not distributed with this
18960 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
18961 
18962 
18964  /* delete standard content */
18965  UA_NodeId_deleteMembers(&node->nodeId);
18966  UA_QualifiedName_deleteMembers(&node->browseName);
18967  UA_LocalizedText_deleteMembers(&node->displayName);
18968  UA_LocalizedText_deleteMembers(&node->description);
18969  UA_Array_delete(node->references, node->referencesSize,
18971  node->references = NULL;
18972  node->referencesSize = 0;
18973 
18974  /* delete unique content of the nodeclass */
18975  switch(node->nodeClass) {
18976  case UA_NODECLASS_OBJECT:
18977  break;
18978  case UA_NODECLASS_METHOD:
18979  break;
18981  break;
18982  case UA_NODECLASS_VARIABLE:
18984  UA_VariableNode *p = (UA_VariableNode*)node;
18985  UA_NodeId_deleteMembers(&p->dataType);
18986  UA_Array_delete(p->arrayDimensions, p->arrayDimensionsSize,
18988  p->arrayDimensions = NULL;
18989  p->arrayDimensionsSize = 0;
18990  if(p->valueSource == UA_VALUESOURCE_DATA)
18991  UA_DataValue_deleteMembers(&p->value.data.value);
18992  break;
18993  }
18996  UA_LocalizedText_deleteMembers(&p->inverseName);
18997  break;
18998  }
18999  case UA_NODECLASS_DATATYPE:
19000  break;
19001  case UA_NODECLASS_VIEW:
19002  break;
19003  default:
19004  break;
19005  }
19006 }
19007 
19008 static UA_StatusCode
19009 UA_ObjectNode_copy(const UA_ObjectNode *src, UA_ObjectNode *dst) {
19010  dst->eventNotifier = src->eventNotifier;
19011  dst->instanceHandle = src->instanceHandle;
19012  return UA_STATUSCODE_GOOD;
19013 }
19014 
19015 static UA_StatusCode
19016 UA_CommonVariableNode_copy(const UA_VariableNode *src, UA_VariableNode *dst) {
19017  UA_StatusCode retval = UA_Array_copy(src->arrayDimensions,
19018  src->arrayDimensionsSize,
19019  (void**)&dst->arrayDimensions,
19021  if(retval != UA_STATUSCODE_GOOD)
19022  return retval;
19023  dst->arrayDimensionsSize = src->arrayDimensionsSize;
19024  retval = UA_NodeId_copy(&src->dataType, &dst->dataType);
19025  dst->valueRank = src->valueRank;
19026  dst->valueSource = src->valueSource;
19027  if(src->valueSource == UA_VALUESOURCE_DATA) {
19028  retval |= UA_DataValue_copy(&src->value.data.value,
19029  &dst->value.data.value);
19030  dst->value.data.callback = src->value.data.callback;
19031  } else
19032  dst->value.dataSource = src->value.dataSource;
19033  return retval;
19034 }
19035 
19036 static UA_StatusCode
19037 UA_VariableNode_copy(const UA_VariableNode *src, UA_VariableNode *dst) {
19038  UA_StatusCode retval = UA_CommonVariableNode_copy(src, dst);
19039  dst->accessLevel = src->accessLevel;
19040  dst->userAccessLevel = src->userAccessLevel;
19042  dst->historizing = src->historizing;
19043  return retval;
19044 }
19045 
19046 static UA_StatusCode
19047 UA_VariableTypeNode_copy(const UA_VariableTypeNode *src,
19048  UA_VariableTypeNode *dst) {
19049  UA_StatusCode retval = UA_CommonVariableNode_copy((const UA_VariableNode*)src,
19050  (UA_VariableNode*)dst);
19051  dst->isAbstract = src->isAbstract;
19052  return retval;
19053 }
19054 
19055 static UA_StatusCode
19056 UA_MethodNode_copy(const UA_MethodNode *src, UA_MethodNode *dst) {
19057  dst->executable = src->executable;
19058  dst->userExecutable = src->userExecutable;
19059  dst->methodHandle = src->methodHandle;
19060  dst->attachedMethod = src->attachedMethod;
19061  return UA_STATUSCODE_GOOD;
19062 }
19063 
19064 static UA_StatusCode
19065 UA_ObjectTypeNode_copy(const UA_ObjectTypeNode *src, UA_ObjectTypeNode *dst) {
19066  dst->isAbstract = src->isAbstract;
19068  return UA_STATUSCODE_GOOD;
19069 }
19070 
19071 static UA_StatusCode
19072 UA_ReferenceTypeNode_copy(const UA_ReferenceTypeNode *src,
19073  UA_ReferenceTypeNode *dst) {
19074  UA_StatusCode retval = UA_LocalizedText_copy(&src->inverseName,
19075  &dst->inverseName);
19076  dst->isAbstract = src->isAbstract;
19077  dst->symmetric = src->symmetric;
19078  return retval;
19079 }
19080 
19081 static UA_StatusCode
19082 UA_DataTypeNode_copy(const UA_DataTypeNode *src, UA_DataTypeNode *dst) {
19083  dst->isAbstract = src->isAbstract;
19084  return UA_STATUSCODE_GOOD;
19085 }
19086 
19087 static UA_StatusCode
19088 UA_ViewNode_copy(const UA_ViewNode *src, UA_ViewNode *dst) {
19089  dst->containsNoLoops = src->containsNoLoops;
19090  dst->eventNotifier = src->eventNotifier;
19091  return UA_STATUSCODE_GOOD;
19092 }
19093 
19094 UA_StatusCode UA_Node_copyAnyNodeClass(const UA_Node *src, UA_Node *dst) {
19095  if(src->nodeClass != dst->nodeClass)
19097 
19098  /* copy standard content */
19099  UA_StatusCode retval = UA_NodeId_copy(&src->nodeId, &dst->nodeId);
19100  dst->nodeClass = src->nodeClass;
19101  retval |= UA_QualifiedName_copy(&src->browseName, &dst->browseName);
19102  retval |= UA_LocalizedText_copy(&src->displayName, &dst->displayName);
19103  retval |= UA_LocalizedText_copy(&src->description, &dst->description);
19104  dst->writeMask = src->writeMask;
19105  dst->userWriteMask = src->userWriteMask;
19106  if(retval != UA_STATUSCODE_GOOD) {
19108  return retval;
19109  }
19110  retval |= UA_Array_copy(src->references, src->referencesSize,
19111  (void**)&dst->references,
19113  if(retval != UA_STATUSCODE_GOOD) {
19115  return retval;
19116  }
19117  dst->referencesSize = src->referencesSize;
19118 
19119  /* copy unique content of the nodeclass */
19120  switch(src->nodeClass) {
19121  case UA_NODECLASS_OBJECT:
19122  retval = UA_ObjectNode_copy((const UA_ObjectNode*)src,
19123  (UA_ObjectNode*)dst);
19124  break;
19125  case UA_NODECLASS_VARIABLE:
19126  retval = UA_VariableNode_copy((const UA_VariableNode*)src,
19127  (UA_VariableNode*)dst);
19128  break;
19129  case UA_NODECLASS_METHOD:
19130  retval = UA_MethodNode_copy((const UA_MethodNode*)src,
19131  (UA_MethodNode*)dst);
19132  break;
19134  retval = UA_ObjectTypeNode_copy((const UA_ObjectTypeNode*)src,
19135  (UA_ObjectTypeNode*)dst);
19136  break;
19138  retval = UA_VariableTypeNode_copy((const UA_VariableTypeNode*)src,
19139  (UA_VariableTypeNode*)dst);
19140  break;
19142  retval = UA_ReferenceTypeNode_copy((const UA_ReferenceTypeNode*)src,
19143  (UA_ReferenceTypeNode*)dst);
19144  break;
19145  case UA_NODECLASS_DATATYPE:
19146  retval = UA_DataTypeNode_copy((const UA_DataTypeNode*)src,
19147  (UA_DataTypeNode*)dst);
19148  break;
19149  case UA_NODECLASS_VIEW:
19150  retval = UA_ViewNode_copy((const UA_ViewNode*)src, (UA_ViewNode*)dst);
19151  break;
19152  default:
19153  break;
19154  }
19155 
19156  if(retval != UA_STATUSCODE_GOOD)
19158 
19159  return retval;
19160 }
19161 
19162 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_nodestore.c" ***********************************/
19163 
19164 /* This Source Code Form is subject to the terms of the Mozilla Public
19165 * License, v. 2.0. If a copy of the MPL was not distributed with this
19166 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
19167 
19168 
19169 #ifndef UA_ENABLE_MULTITHREADING /* conditional compilation */
19170 
19171 #define UA_NODESTORE_MINSIZE 64
19172 
19173 typedef struct UA_NodeStoreEntry {
19174  struct UA_NodeStoreEntry *orig; // the version this is a copy from (or NULL)
19175  UA_Node node;
19177 
19178 #define UA_NODESTORE_TOMBSTONE ((UA_NodeStoreEntry*)0x01)
19179 
19185 };
19186 
19187 /* The size of the hash-map is always a prime number. They are chosen to be
19188  * close to the next power of 2. So the size ca. doubles with each prime. */
19189 static UA_UInt32 const primes[] = {
19190  7, 13, 31, 61, 127, 251,
19191  509, 1021, 2039, 4093, 8191, 16381,
19192  32749, 65521, 131071, 262139, 524287, 1048573,
19193  2097143, 4194301, 8388593, 16777213, 33554393, 67108859,
19194  134217689, 268435399, 536870909, 1073741789, 2147483647, 4294967291
19195 };
19196 
19197 static UA_UInt32 mod(UA_UInt32 h, UA_UInt32 size) { return h % size; }
19198 static UA_UInt32 mod2(UA_UInt32 h, UA_UInt32 size) { return 1 + (h % (size - 2)); }
19199 
19200 static UA_UInt16
19201 higher_prime_index(UA_UInt32 n) {
19202  UA_UInt16 low = 0;
19203  UA_UInt16 high = (UA_UInt16)(sizeof(primes) / sizeof(UA_UInt32));
19204  while(low != high) {
19205  UA_UInt16 mid = (UA_UInt16)(low + ((high - low) / 2));
19206  if(n > primes[mid])
19207  low = (UA_UInt16)(mid + 1);
19208  else
19209  high = mid;
19210  }
19211  return low;
19212 }
19213 
19214 static UA_NodeStoreEntry *
19215 instantiateEntry(UA_NodeClass nodeClass) {
19216  size_t size = sizeof(UA_NodeStoreEntry) - sizeof(UA_Node);
19217  switch(nodeClass) {
19218  case UA_NODECLASS_OBJECT:
19219  size += sizeof(UA_ObjectNode);
19220  break;
19221  case UA_NODECLASS_VARIABLE:
19222  size += sizeof(UA_VariableNode);
19223  break;
19224  case UA_NODECLASS_METHOD:
19225  size += sizeof(UA_MethodNode);
19226  break;
19228  size += sizeof(UA_ObjectTypeNode);
19229  break;
19231  size += sizeof(UA_VariableTypeNode);
19232  break;
19234  size += sizeof(UA_ReferenceTypeNode);
19235  break;
19236  case UA_NODECLASS_DATATYPE:
19237  size += sizeof(UA_DataTypeNode);
19238  break;
19239  case UA_NODECLASS_VIEW:
19240  size += sizeof(UA_ViewNode);
19241  break;
19242  default:
19243  return NULL;
19244  }
19245  UA_NodeStoreEntry *entry = UA_calloc(1, size);
19246  if(!entry)
19247  return NULL;
19248  entry->node.nodeClass = nodeClass;
19249  return entry;
19250 }
19251 
19252 static void
19253 deleteEntry(UA_NodeStoreEntry *entry) {
19255  UA_free(entry);
19256 }
19257 
19258 /* returns slot of a valid node or null */
19259 static UA_NodeStoreEntry **
19260 findNode(const UA_NodeStore *ns, const UA_NodeId *nodeid) {
19261  UA_UInt32 h = UA_NodeId_hash(nodeid);
19262  UA_UInt32 size = ns->size;
19263  UA_UInt32 idx = mod(h, size);
19264  UA_UInt32 hash2 = mod2(h, size);
19265 
19266  while(true) {
19267  UA_NodeStoreEntry *e = ns->entries[idx];
19268  if(!e)
19269  return NULL;
19270  if(e > UA_NODESTORE_TOMBSTONE &&
19271  UA_NodeId_equal(&e->node.nodeId, nodeid))
19272  return &ns->entries[idx];
19273  idx += hash2;
19274  if(idx >= size)
19275  idx -= size;
19276  }
19277 
19278  /* NOTREACHED */
19279  return NULL;
19280 }
19281 
19282 /* returns an empty slot or null if the nodeid exists */
19283 static UA_NodeStoreEntry **
19284 findSlot(const UA_NodeStore *ns, const UA_NodeId *nodeid) {
19285  UA_UInt32 h = UA_NodeId_hash(nodeid);
19286  UA_UInt32 size = ns->size;
19287  UA_UInt32 idx = mod(h, size);
19288  UA_UInt32 hash2 = mod2(h, size);
19289 
19290  while(true) {
19291  UA_NodeStoreEntry *e = ns->entries[idx];
19292  if(e > UA_NODESTORE_TOMBSTONE &&
19293  UA_NodeId_equal(&e->node.nodeId, nodeid))
19294  return NULL;
19295  if(ns->entries[idx] <= UA_NODESTORE_TOMBSTONE)
19296  return &ns->entries[idx];
19297  idx += hash2;
19298  if(idx >= size)
19299  idx -= size;
19300  }
19301 
19302  /* NOTREACHED */
19303  return NULL;
19304 }
19305 
19306 /* The occupancy of the table after the call will be about 50% */
19307 static UA_StatusCode
19308 expand(UA_NodeStore *ns) {
19309  UA_UInt32 osize = ns->size;
19310  UA_UInt32 count = ns->count;
19311  /* Resize only when table after removal of unused elements is either too
19312  full or too empty */
19313  if(count * 2 < osize && (count * 8 > osize || osize <= UA_NODESTORE_MINSIZE))
19314  return UA_STATUSCODE_GOOD;
19315 
19316  UA_NodeStoreEntry **oentries = ns->entries;
19317  UA_UInt32 nindex = higher_prime_index(count * 2);
19318  UA_UInt32 nsize = primes[nindex];
19319  UA_NodeStoreEntry **nentries = UA_calloc(nsize, sizeof(UA_NodeStoreEntry*));
19320  if(!nentries)
19322 
19323  ns->entries = nentries;
19324  ns->size = nsize;
19325  ns->sizePrimeIndex = nindex;
19326 
19327  /* recompute the position of every entry and insert the pointer */
19328  for(size_t i = 0, j = 0; i < osize && j < count; ++i) {
19329  if(oentries[i] <= UA_NODESTORE_TOMBSTONE)
19330  continue;
19331  UA_NodeStoreEntry **e = findSlot(ns, &oentries[i]->node.nodeId);
19332  UA_assert(e);
19333  *e = oentries[i];
19334  ++j;
19335  }
19336 
19337  UA_free(oentries);
19338  return UA_STATUSCODE_GOOD;
19339 }
19340 
19341 /**********************/
19342 /* Exported functions */
19343 /**********************/
19344 
19345 UA_NodeStore *
19347  UA_NodeStore *ns = UA_malloc(sizeof(UA_NodeStore));
19348  if(!ns)
19349  return NULL;
19350  ns->sizePrimeIndex = higher_prime_index(UA_NODESTORE_MINSIZE);
19351  ns->size = primes[ns->sizePrimeIndex];
19352  ns->count = 0;
19353  ns->entries = UA_calloc(ns->size, sizeof(UA_NodeStoreEntry*));
19354  if(!ns->entries) {
19355  UA_free(ns);
19356  return NULL;
19357  }
19358  return ns;
19359 }
19360 
19361 void
19363  UA_UInt32 size = ns->size;
19364  UA_NodeStoreEntry **entries = ns->entries;
19365  for(UA_UInt32 i = 0; i < size; ++i) {
19366  if(entries[i] > UA_NODESTORE_TOMBSTONE)
19367  deleteEntry(entries[i]);
19368  }
19369  UA_free(ns->entries);
19370  UA_free(ns);
19371 }
19372 
19373 UA_Node *
19375  UA_NodeStoreEntry *entry = instantiateEntry(nodeClass);
19376  if(!entry)
19377  return NULL;
19378  return &entry->node;
19379 }
19380 
19381 void
19382 UA_NodeStore_deleteNode(UA_Node *node) {
19383  UA_NodeStoreEntry *entry = container_of(node, UA_NodeStoreEntry, node);
19384  UA_assert(&entry->node == node);
19385  deleteEntry(entry);
19386 }
19387 
19389 UA_NodeStore_insert(UA_NodeStore *ns, UA_Node *node) {
19390  if(ns->size * 3 <= ns->count * 4) {
19391  if(expand(ns) != UA_STATUSCODE_GOOD)
19393  }
19394 
19395  UA_NodeId tempNodeid;
19396  tempNodeid = node->nodeId;
19397  tempNodeid.namespaceIndex = 0;
19398  UA_NodeStoreEntry **entry;
19399  if(UA_NodeId_isNull(&tempNodeid)) {
19400  /* create a random nodeid */
19401  if(node->nodeId.namespaceIndex == 0)
19402  node->nodeId.namespaceIndex = 1;
19403  UA_UInt32 identifier = ns->count+1; // start value
19404  UA_UInt32 size = ns->size;
19405  UA_UInt32 increase = mod2(identifier, size);
19406  while(true) {
19407  node->nodeId.identifier.numeric = identifier;
19408  entry = findSlot(ns, &node->nodeId);
19409  if(entry)
19410  break;
19411  identifier += increase;
19412  if(identifier >= size)
19413  identifier -= size;
19414  }
19415  } else {
19416  entry = findSlot(ns, &node->nodeId);
19417  if(!entry) {
19420  }
19421  }
19422 
19423  *entry = container_of(node, UA_NodeStoreEntry, node);
19424  ++ns->count;
19425  UA_assert(&(*entry)->node == node);
19426  return UA_STATUSCODE_GOOD;
19427 }
19428 
19430 UA_NodeStore_replace(UA_NodeStore *ns, UA_Node *node) {
19431  UA_NodeStoreEntry **entry = findNode(ns, &node->nodeId);
19432  if(!entry)
19434  UA_NodeStoreEntry *newEntry = container_of(node, UA_NodeStoreEntry, node);
19435  if(*entry != newEntry->orig) {
19436  // the node was replaced since the copy was made
19437  deleteEntry(newEntry);
19439  }
19440  deleteEntry(*entry);
19441  *entry = newEntry;
19442  return UA_STATUSCODE_GOOD;
19443 }
19444 
19445 const UA_Node *
19447  UA_NodeStoreEntry **entry = findNode(ns, nodeid);
19448  if(!entry)
19449  return NULL;
19450  return (const UA_Node*)&(*entry)->node;
19451 }
19452 
19453 UA_Node *
19455  UA_NodeStoreEntry **slot = findNode(ns, nodeid);
19456  if(!slot)
19457  return NULL;
19458  UA_NodeStoreEntry *entry = *slot;
19459  UA_NodeStoreEntry *new = instantiateEntry(entry->node.nodeClass);
19460  if(!new)
19461  return NULL;
19462  if(UA_Node_copyAnyNodeClass(&entry->node, &new->node) != UA_STATUSCODE_GOOD) {
19463  deleteEntry(new);
19464  return NULL;
19465  }
19466  new->orig = entry; // store the pointer to the original
19467  return &new->node;
19468 }
19469 
19472  UA_NodeStoreEntry **slot = findNode(ns, nodeid);
19473  if(!slot)
19475  deleteEntry(*slot);
19476  *slot = UA_NODESTORE_TOMBSTONE;
19477  --ns->count;
19478  /* Downsize the hashmap if it is very empty */
19479  if(ns->count * 8 < ns->size && ns->size > 32)
19480  expand(ns); // this can fail. we just continue with the bigger hashmap.
19481  return UA_STATUSCODE_GOOD;
19482 }
19483 
19484 void
19486  for(UA_UInt32 i = 0; i < ns->size; ++i) {
19487  if(ns->entries[i] > UA_NODESTORE_TOMBSTONE)
19488  visitor((UA_Node*)&ns->entries[i]->node);
19489  }
19490 }
19491 
19492 #endif /* UA_ENABLE_MULTITHREADING */
19493 
19494 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_nodestore_concurrent.c" ***********************************/
19495 
19496 /* This Source Code Form is subject to the terms of the Mozilla Public
19497 * License, v. 2.0. If a copy of the MPL was not distributed with this
19498 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
19499 
19500 
19501 #ifdef UA_ENABLE_MULTITHREADING /* conditional compilation */
19502 #include <urcu/rculfhash.h>
19503 
19504 struct nodeEntry {
19505  struct cds_lfht_node htn;
19506  struct rcu_head rcu_head;
19507  struct nodeEntry *orig; //< the version this is a copy from (or NULL)
19508  UA_Node node;
19509 };
19510 
19511 static struct nodeEntry * instantiateEntry(UA_NodeClass class) {
19512  size_t size = sizeof(struct nodeEntry) - sizeof(UA_Node);
19513  switch(class) {
19514  case UA_NODECLASS_OBJECT:
19515  size += sizeof(UA_ObjectNode);
19516  break;
19517  case UA_NODECLASS_VARIABLE:
19518  size += sizeof(UA_VariableNode);
19519  break;
19520  case UA_NODECLASS_METHOD:
19521  size += sizeof(UA_MethodNode);
19522  break;
19524  size += sizeof(UA_ObjectTypeNode);
19525  break;
19527  size += sizeof(UA_VariableTypeNode);
19528  break;
19530  size += sizeof(UA_ReferenceTypeNode);
19531  break;
19532  case UA_NODECLASS_DATATYPE:
19533  size += sizeof(UA_DataTypeNode);
19534  break;
19535  case UA_NODECLASS_VIEW:
19536  size += sizeof(UA_ViewNode);
19537  break;
19538  default:
19539  return NULL;
19540  }
19541  struct nodeEntry *entry = UA_calloc(1, size);
19542  if(!entry)
19543  return NULL;
19544  entry->node.nodeClass = class;
19545  return entry;
19546 }
19547 
19548 static void deleteEntry(struct rcu_head *head) {
19549  struct nodeEntry *entry = container_of(head, struct nodeEntry, rcu_head);
19550  UA_Node_deleteMembersAnyNodeClass(&entry->node);
19551  UA_free(entry);
19552 }
19553 
19554 /* We are in a rcu_read lock. So the node will not be freed under our feet. */
19555 static int compare(struct cds_lfht_node *htn, const void *orig) {
19556  const UA_NodeId *origid = (const UA_NodeId *)orig;
19557  /* The htn is first in the entry structure. */
19558  const UA_NodeId *newid = &((struct nodeEntry *)htn)->node.nodeId;
19559  return UA_NodeId_equal(newid, origid);
19560 }
19561 
19563  /* 64 is the minimum size for the hashtable. */
19564  return (UA_NodeStore*)cds_lfht_new(64, 64, 0, CDS_LFHT_AUTO_RESIZE, NULL);
19565 }
19566 
19567 /* do not call with read-side critical section held!! */
19570  struct cds_lfht *ht = (struct cds_lfht*)ns;
19571  struct cds_lfht_iter iter;
19572  cds_lfht_first(ht, &iter);
19573  while(iter.node) {
19574  if(!cds_lfht_del(ht, iter.node)) {
19575  /* points to the htn entry, which is first */
19576  struct nodeEntry *entry = (struct nodeEntry*) iter.node;
19577  call_rcu(&entry->rcu_head, deleteEntry);
19578  }
19579  cds_lfht_next(ht, &iter);
19580  }
19581  UA_RCU_UNLOCK();
19582  cds_lfht_destroy(ht, NULL);
19583  UA_RCU_LOCK();
19584 }
19585 
19586 UA_Node * UA_NodeStore_newNode(UA_NodeClass class) {
19587  struct nodeEntry *entry = instantiateEntry(class);
19588  if(!entry)
19589  return NULL;
19590  return (UA_Node*)&entry->node;
19591 }
19592 
19593 void UA_NodeStore_deleteNode(UA_Node *node) {
19594  struct nodeEntry *entry = container_of(node, struct nodeEntry, node);
19595  deleteEntry(&entry->rcu_head);
19596 }
19597 
19598 UA_StatusCode UA_NodeStore_insert(UA_NodeStore *ns, UA_Node *node) {
19600  struct nodeEntry *entry = container_of(node, struct nodeEntry, node);
19601  struct cds_lfht *ht = (struct cds_lfht*)ns;
19602  cds_lfht_node_init(&entry->htn);
19603  struct cds_lfht_node *result;
19604  //namespace index is assumed to be valid
19605  UA_NodeId tempNodeid;
19606  tempNodeid = node->nodeId;
19607  tempNodeid.namespaceIndex = 0;
19608  if(!UA_NodeId_isNull(&tempNodeid)) {
19609  UA_UInt32 h = UA_NodeId_hash(&node->nodeId);
19610  result = cds_lfht_add_unique(ht, h, compare, &node->nodeId, &entry->htn);
19611  /* If the nodeid exists already */
19612  if(result != &entry->htn) {
19613  deleteEntry(&entry->rcu_head);
19615  }
19616  } else {
19617  /* create a unique nodeid */
19618  node->nodeId.identifierType = UA_NODEIDTYPE_NUMERIC;
19619  if(node->nodeId.namespaceIndex == 0) // original request for ns=0 should yield ns=1
19620  node->nodeId.namespaceIndex = 1;
19621 
19622  unsigned long identifier;
19623  long before, after;
19624  cds_lfht_count_nodes(ht, &before, &identifier, &after); // current number of nodes stored
19625  ++identifier;
19626 
19627  node->nodeId.identifier.numeric = (UA_UInt32)identifier;
19628  while(true) {
19629  UA_UInt32 h = UA_NodeId_hash(&node->nodeId);
19630  result = cds_lfht_add_unique(ht, h, compare, &node->nodeId, &entry->htn);
19631  if(result == &entry->htn)
19632  break;
19633  node->nodeId.identifier.numeric += (UA_UInt32)(identifier * 2654435761);
19634  }
19635  }
19636  return UA_STATUSCODE_GOOD;
19637 }
19638 
19639 UA_StatusCode UA_NodeStore_replace(UA_NodeStore *ns, UA_Node *node) {
19641  struct nodeEntry *entry = container_of(node, struct nodeEntry, node);
19642  struct cds_lfht *ht = (struct cds_lfht*)ns;
19643 
19644  /* Get the current version */
19645  UA_UInt32 h = UA_NodeId_hash(&node->nodeId);
19646  struct cds_lfht_iter iter;
19647  cds_lfht_lookup(ht, h, compare, &node->nodeId, &iter);
19648  if(!iter.node)
19650 
19651  /* We try to replace an obsolete version of the node */
19652  struct nodeEntry *oldEntry = (struct nodeEntry*)iter.node;
19653  if(oldEntry != entry->orig) {
19654  deleteEntry(&entry->rcu_head);
19656  }
19657 
19658  cds_lfht_node_init(&entry->htn);
19659  if(cds_lfht_replace(ht, &iter, h, compare, &node->nodeId, &entry->htn) != 0) {
19660  /* Replacing failed. Maybe the node got replaced just before this thread tried to.*/
19661  deleteEntry(&entry->rcu_head);
19663  }
19664 
19665  /* If an entry got replaced, mark it as dead. */
19666  call_rcu(&oldEntry->rcu_head, deleteEntry);
19667  return UA_STATUSCODE_GOOD;
19668 }
19669 
19672  struct cds_lfht *ht = (struct cds_lfht*)ns;
19673  UA_UInt32 h = UA_NodeId_hash(nodeid);
19674  struct cds_lfht_iter iter;
19675  cds_lfht_lookup(ht, h, compare, nodeid, &iter);
19676  if(!iter.node || cds_lfht_del(ht, iter.node) != 0)
19678  struct nodeEntry *entry = (struct nodeEntry*)iter.node;
19679  call_rcu(&entry->rcu_head, deleteEntry);
19680  return UA_STATUSCODE_GOOD;
19681 }
19682 
19683 const UA_Node * UA_NodeStore_get(UA_NodeStore *ns, const UA_NodeId *nodeid) {
19685  struct cds_lfht *ht = (struct cds_lfht*)ns;
19686  UA_UInt32 h = UA_NodeId_hash(nodeid);
19687  struct cds_lfht_iter iter;
19688  cds_lfht_lookup(ht, h, compare, nodeid, &iter);
19689  struct nodeEntry *found_entry = (struct nodeEntry*)iter.node;
19690  if(!found_entry)
19691  return NULL;
19692  return &found_entry->node;
19693 }
19694 
19695 UA_Node * UA_NodeStore_getCopy(UA_NodeStore *ns, const UA_NodeId *nodeid) {
19697  struct cds_lfht *ht = (struct cds_lfht*)ns;
19698  UA_UInt32 h = UA_NodeId_hash(nodeid);
19699  struct cds_lfht_iter iter;
19700  cds_lfht_lookup(ht, h, compare, nodeid, &iter);
19701  struct nodeEntry *entry = (struct nodeEntry*)iter.node;
19702  if(!entry)
19703  return NULL;
19704  struct nodeEntry *new = instantiateEntry(entry->node.nodeClass);
19705  if(!new)
19706  return NULL;
19707  if(UA_Node_copyAnyNodeClass(&entry->node, &new->node) != UA_STATUSCODE_GOOD) {
19708  deleteEntry(&new->rcu_head);
19709  return NULL;
19710  }
19711  new->orig = entry;
19712  return &new->node;
19713 }
19714 
19717  struct cds_lfht *ht = (struct cds_lfht*)ns;
19718  struct cds_lfht_iter iter;
19719  cds_lfht_first(ht, &iter);
19720  while(iter.node != NULL) {
19721  struct nodeEntry *found_entry = (struct nodeEntry*)iter.node;
19722  visitor(&found_entry->node);
19723  cds_lfht_next(ht, &iter);
19724  }
19725 }
19726 
19727 #endif /* UA_ENABLE_MULTITHREADING */
19728 
19729 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_services_discovery.c" ***********************************/
19730 
19731 /* This Source Code Form is subject to the terms of the Mozilla Public
19732 * License, v. 2.0. If a copy of the MPL was not distributed with this
19733 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
19734 
19735 
19736 void Service_FindServers(UA_Server *server, UA_Session *session,
19737  const UA_FindServersRequest *request, UA_FindServersResponse *response) {
19738  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing FindServersRequest");
19739  /* copy ApplicationDescription from the config */
19741  if(!descr) {
19743  return;
19744  }
19745  response->responseHeader.serviceResult =
19746  UA_ApplicationDescription_copy(&server->config.applicationDescription, descr);
19748  UA_free(descr);
19749  return;
19750  }
19751 
19752  /* add the discoveryUrls from the networklayers */
19753  UA_String *disc = UA_realloc(descr->discoveryUrls, sizeof(UA_String) *
19754  (descr->discoveryUrlsSize + server->config.networkLayersSize));
19755  if(!disc) {
19757  UA_ApplicationDescription_delete(descr);
19758  return;
19759  }
19760  size_t existing = descr->discoveryUrlsSize;
19761  descr->discoveryUrls = disc;
19762  descr->discoveryUrlsSize += server->config.networkLayersSize;
19763 
19764  // TODO: Add nl only if discoveryUrl not already present
19765  for(size_t i = 0; i < server->config.networkLayersSize; ++i) {
19766  UA_ServerNetworkLayer *nl = &server->config.networkLayers[i];
19767  UA_String_copy(&nl->discoveryUrl, &descr->discoveryUrls[existing + i]);
19768  }
19769 
19770  response->servers = descr;
19771  response->serversSize = 1;
19772 }
19773 
19774 void Service_GetEndpoints(UA_Server *server, UA_Session *session, const UA_GetEndpointsRequest *request,
19775  UA_GetEndpointsResponse *response) {
19776  /* If the client expects to see a specific endpointurl, mirror it back. If
19777  not, clone the endpoints with the discovery url of all networklayers. */
19778  const UA_String *endpointUrl = &request->endpointUrl;
19779  if(endpointUrl->length > 0) {
19780  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing GetEndpointsRequest with endpointUrl " \
19782  } else {
19783  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing GetEndpointsRequest with an empty endpointUrl");
19784  }
19785 
19786  /* test if the supported binary profile shall be returned */
19787 #ifdef NO_ALLOCA
19788  UA_Boolean relevant_endpoints[server->endpointDescriptionsSize];
19789 #else
19790  UA_Boolean *relevant_endpoints = UA_alloca(sizeof(UA_Boolean) * server->endpointDescriptionsSize);
19791 #endif
19792  memset(relevant_endpoints, 0, sizeof(UA_Boolean) * server->endpointDescriptionsSize);
19793  size_t relevant_count = 0;
19794  if(request->profileUrisSize == 0) {
19795  for(size_t j = 0; j < server->endpointDescriptionsSize; ++j)
19796  relevant_endpoints[j] = true;
19797  relevant_count = server->endpointDescriptionsSize;
19798  } else {
19799  for(size_t j = 0; j < server->endpointDescriptionsSize; ++j) {
19800  for(size_t i = 0; i < request->profileUrisSize; ++i) {
19802  continue;
19803  relevant_endpoints[j] = true;
19804  ++relevant_count;
19805  break;
19806  }
19807  }
19808  }
19809 
19810  if(relevant_count == 0) {
19811  response->endpointsSize = 0;
19812  return;
19813  }
19814 
19815  /* Clone the endpoint for each networklayer? */
19816  size_t clone_times = 1;
19817  UA_Boolean nl_endpointurl = false;
19818  if(endpointUrl->length == 0) {
19819  clone_times = server->config.networkLayersSize;
19820  nl_endpointurl = true;
19821  }
19822 
19823  response->endpoints = UA_Array_new(relevant_count * clone_times, &UA_TYPES[UA_TYPES_ENDPOINTDESCRIPTION]);
19824  if(!response->endpoints) {
19826  return;
19827  }
19828  response->endpointsSize = relevant_count * clone_times;
19829 
19830  size_t k = 0;
19832  for(size_t i = 0; i < clone_times; ++i) {
19833  if(nl_endpointurl)
19834  endpointUrl = &server->config.networkLayers[i].discoveryUrl;
19835  for(size_t j = 0; j < server->endpointDescriptionsSize; ++j) {
19836  if(!relevant_endpoints[j])
19837  continue;
19838  retval |= UA_EndpointDescription_copy(&server->endpointDescriptions[j], &response->endpoints[k]);
19839  retval |= UA_String_copy(endpointUrl, &response->endpoints[k].endpointUrl);
19840  ++k;
19841  }
19842  }
19843 
19844  if(retval != UA_STATUSCODE_GOOD) {
19845  response->responseHeader.serviceResult = retval;
19846  UA_Array_delete(response->endpoints, response->endpointsSize, &UA_TYPES[UA_TYPES_ENDPOINTDESCRIPTION]);
19847  response->endpoints = NULL;
19848  response->endpointsSize = 0;
19849  return;
19850  }
19851 }
19852 
19853 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_services_securechannel.c" ***********************************/
19854 
19855 /* This Source Code Form is subject to the terms of the Mozilla Public
19856 * License, v. 2.0. If a copy of the MPL was not distributed with this
19857 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
19858 
19859 
19860 void Service_OpenSecureChannel(UA_Server *server, UA_Connection *connection,
19861  const UA_OpenSecureChannelRequest *request,
19862  UA_OpenSecureChannelResponse *response) {
19863  // todo: if(request->clientProtocolVersion != protocolVersion)
19865  response->responseHeader.serviceResult =
19866  UA_SecureChannelManager_open(&server->secureChannelManager, connection, request, response);
19867 
19869  UA_LOG_INFO(server->config.logger, UA_LOGCATEGORY_SECURECHANNEL,
19870  "Connection %i | SecureChannel %i | OpenSecureChannel: Opened SecureChannel",
19871  connection->sockfd, response->securityToken.channelId);
19872  } else {
19873  UA_LOG_DEBUG(server->config.logger, UA_LOGCATEGORY_SECURECHANNEL,
19874  "Connection %i | OpenSecureChannel: Opening a SecureChannel failed",
19875  connection->sockfd);
19876  }
19877  } else {
19878  response->responseHeader.serviceResult =
19879  UA_SecureChannelManager_renew(&server->secureChannelManager, connection, request, response);
19880 
19882  UA_LOG_DEBUG(server->config.logger, UA_LOGCATEGORY_SECURECHANNEL,
19883  "Connection %i | SecureChannel %i | OpenSecureChannel: SecureChannel renewed",
19884  connection->sockfd, response->securityToken.channelId);
19885  } else {
19886  UA_LOG_DEBUG(server->config.logger, UA_LOGCATEGORY_SECURECHANNEL,
19887  "Connection %i | OpenSecureChannel: Renewing SecureChannel failed",
19888  connection->sockfd);
19889  }
19890  }
19891 }
19892 
19893 /* The server does not send a CloseSecureChannel response */
19894 void Service_CloseSecureChannel(UA_Server *server, UA_SecureChannel *channel) {
19895  UA_LOG_INFO_CHANNEL(server->config.logger, channel, "CloseSecureChannel");
19897 }
19898 
19899 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_services_session.c" ***********************************/
19900 
19901 /* This Source Code Form is subject to the terms of the Mozilla Public
19902 * License, v. 2.0. If a copy of the MPL was not distributed with this
19903 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
19904 
19905 
19906 void Service_CreateSession(UA_Server *server, UA_SecureChannel *channel,
19907  const UA_CreateSessionRequest *request,
19908  UA_CreateSessionResponse *response) {
19909  if(channel->securityToken.channelId == 0) {
19911  return;
19912  }
19913 
19914  /* Copy the server's endpoint into the response */
19915  response->responseHeader.serviceResult =
19917  (void**)&response->serverEndpoints, &UA_TYPES[UA_TYPES_ENDPOINTDESCRIPTION]);
19919  return;
19920  response->serverEndpointsSize = server->endpointDescriptionsSize;
19921 
19922  /* Mirror back the endpointUrl */
19923  for(size_t i = 0; i < response->serverEndpointsSize; ++i)
19924  UA_String_copy(&request->endpointUrl, &response->serverEndpoints[i].endpointUrl);
19925 
19926  UA_Session *newSession;
19927  response->responseHeader.serviceResult =
19928  UA_SessionManager_createSession(&server->sessionManager, channel, request, &newSession);
19930  UA_LOG_DEBUG_CHANNEL(server->config.logger, channel, "Processing CreateSessionRequest failed");
19931  return;
19932  }
19933 
19934  newSession->maxResponseMessageSize = request->maxResponseMessageSize;
19935  newSession->maxRequestMessageSize = channel->connection->localConf.maxMessageSize;
19936  response->sessionId = newSession->sessionId;
19937  response->revisedSessionTimeout = (UA_Double)newSession->timeout;
19938  response->authenticationToken = newSession->authenticationToken;
19939  response->responseHeader.serviceResult = UA_String_copy(&request->sessionName, &newSession->sessionName);
19940  if(server->endpointDescriptionsSize > 0)
19941  response->responseHeader.serviceResult |=
19942  UA_ByteString_copy(&server->endpointDescriptions->serverCertificate,
19943  &response->serverCertificate);
19946  return;
19947  }
19948  UA_LOG_DEBUG_CHANNEL(server->config.logger, channel, "Session " UA_PRINTF_GUID_FORMAT " created",
19950 }
19951 
19952 void
19953 Service_ActivateSession(UA_Server *server, UA_SecureChannel *channel,
19954  UA_Session *session, const UA_ActivateSessionRequest *request,
19955  UA_ActivateSessionResponse *response) {
19956  if(session->validTill < UA_DateTime_nowMonotonic()) {
19957  if(++channel->invalidSessionAccessCounter > 3)
19958  Service_CloseSecureChannel(server, channel);
19959 
19960  UA_LOG_INFO_SESSION(server->config.logger, session, "ActivateSession: SecureChannel %i wants "
19961  "to activate, but the session has timed out", channel->securityToken.channelId);
19963  return;
19964  }
19965  channel->invalidSessionAccessCounter = 0;
19966 
19970  UA_LOG_INFO_SESSION(server->config.logger, session, "ActivateSession: SecureChannel %i wants "
19971  "to activate, but the UserIdentify token is invalid", channel->securityToken.channelId);
19973  return;
19974  }
19975 
19976 
19977  UA_String ap = UA_STRING(ANONYMOUS_POLICY);
19978  UA_String up = UA_STRING(USERNAME_POLICY);
19979 
19980  /* Compatibility notice: Siemens OPC Scout v10 provides an empty policyId,
19981  this is not okay For compatibility we will assume that empty policyId == ANONYMOUS_POLICY
19982  if(token.policyId->data == NULL)
19983  response->responseHeader.serviceResult = UA_STATUSCODE_BADIDENTITYTOKENINVALID;
19984  */
19985 
19986  if(server->config.enableAnonymousLogin &&
19988  /* anonymous login */
19989  const UA_AnonymousIdentityToken *token = request->userIdentityToken.content.decoded.data;
19990  if(token->policyId.data && !UA_String_equal(&token->policyId, &ap)) {
19992  return;
19993  }
19994  } else if(server->config.enableUsernamePasswordLogin &&
19995  request->userIdentityToken.content.decoded.type == &UA_TYPES[UA_TYPES_USERNAMEIDENTITYTOKEN]) {
19996  /* username login */
19997  const UA_UserNameIdentityToken *token = request->userIdentityToken.content.decoded.data;
19998  if(!UA_String_equal(&token->policyId, &up)) {
20000  return;
20001  }
20002  if(token->encryptionAlgorithm.length > 0) {
20003  /* we don't support encryption */
20005  return;
20006  }
20007 
20008  if(token->userName.length == 0 && token->password.length == 0) {
20009  /* empty username and password */
20011  return;
20012  }
20013 
20014  /* trying to match pw/username */
20015  UA_Boolean match = false;
20016  for(size_t i = 0; i < server->config.usernamePasswordLoginsSize; ++i) {
20017  UA_String *user = &server->config.usernamePasswordLogins[i].username;
20018  UA_String *pw = &server->config.usernamePasswordLogins[i].password;
20019  if(UA_String_equal(&token->userName, user) && UA_String_equal(&token->password, pw)) {
20020  match = true;
20021  break;
20022  }
20023  }
20024  if(!match) {
20025  UA_LOG_INFO_SESSION(server->config.logger, session,
20026  "ActivateSession: Did not find matching username/password");
20028  return;
20029  }
20030  } else {
20031  /* Unsupported token type */
20033  return;
20034  }
20035 
20036  /* Detach the old SecureChannel */
20037  if(session->channel && session->channel != channel) {
20038  UA_LOG_INFO_SESSION(server->config.logger, session, "ActivateSession: Detach from old channel");
20039  UA_SecureChannel_detachSession(session->channel, session);
20040  }
20041 
20042  /* Attach to the SecureChannel and activate */
20043  UA_SecureChannel_attachSession(channel, session);
20044  session->activated = true;
20045  UA_Session_updateLifetime(session);
20046  UA_LOG_INFO_SESSION(server->config.logger, session, "ActivateSession: Session activated");
20047 }
20048 
20049 void
20050 Service_CloseSession(UA_Server *server, UA_Session *session, const UA_CloseSessionRequest *request,
20051  UA_CloseSessionResponse *response) {
20052  UA_LOG_INFO_SESSION(server->config.logger, session, "CloseSession");
20053  response->responseHeader.serviceResult =
20055 }
20056 
20057 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_services_attribute.c" ***********************************/
20058 
20059 /* This Source Code Form is subject to the terms of the Mozilla Public
20060 * License, v. 2.0. If a copy of the MPL was not distributed with this
20061 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
20062 
20063 #ifdef UA_ENABLE_NONSTANDARD_STATELESS
20064 #endif
20065 
20066 /* Force cast from const data for zero-copy reading. The storage type is set to
20067  nodelete. So the value is not deleted. Use with care! */
20068 static void
20069 forceVariantSetScalar(UA_Variant *v, const void *p, const UA_DataType *t) {
20070  UA_Variant_init(v);
20071  v->type = t;
20072  v->data = (void*)(uintptr_t)p;
20074 }
20075 
20076 /*****************/
20077 /* Type Checking */
20078 /*****************/
20079 
20084 };
20085 
20086 static enum type_equivalence
20087 typeEquivalence(const UA_DataType *t) {
20088  if(t->membersSize != 1 || !t->members[0].namespaceZero)
20089  return TYPE_EQUIVALENCE_NONE;
20091  return TYPE_EQUIVALENCE_ENUM;
20092  if(t->members[0].memberTypeIndex == UA_TYPES_BYTE && t->members[0].isArray)
20093  return TYPE_EQUIVALENCE_OPAQUE;
20094  return TYPE_EQUIVALENCE_NONE;
20095 }
20096 
20097 /* Test whether a valurank and the given arraydimensions are compatible. zero
20098  * array dimensions indicate a scalar */
20099 static UA_StatusCode
20100 compatibleValueRankArrayDimensions(UA_Int32 valueRank, size_t arrayDimensionsSize) {
20101  switch(valueRank) {
20102  case -3: /* the value can be a scalar or a one dimensional array */
20103  if(arrayDimensionsSize > 1)
20105  break;
20106  case -2: /* the value can be a scalar or an array with any number of dimensions */
20107  break;
20108  case -1: /* the value is a scalar */
20109  if(arrayDimensionsSize > 0)
20111  break;
20112  case 0: /* the value is an array with one or more dimensions */
20113  if(arrayDimensionsSize < 1)
20115  break;
20116  default: /* >= 1: the value is an array with the specified number of dimensions */
20117  if(valueRank < 0)
20119  /* Must hold if the array has a defined length. Null arrays (length -1)
20120  * need to be caught before. */
20121  if(arrayDimensionsSize != (size_t)valueRank)
20123  }
20124  return UA_STATUSCODE_GOOD;
20125 }
20126 
20127 /* Check if the valuerank allows for the value dimension */
20128 static UA_StatusCode
20129 compatibleValueRankValue(UA_Int32 valueRank, const UA_Variant *value) {
20130  /* empty arrays (-1) always match */
20131  if(value->data == NULL)
20132  return UA_STATUSCODE_GOOD;
20133 
20134  size_t arrayDims = value->arrayDimensionsSize;
20135  if(!UA_Variant_isScalar(value))
20136  arrayDims = 1; /* array but no arraydimensions -> implicit array dimension 1 */
20137  return compatibleValueRankArrayDimensions(valueRank, arrayDims);
20138 }
20139 
20141 compatibleArrayDimensions(size_t constraintArrayDimensionsSize,
20142  const UA_UInt32 *constraintArrayDimensions,
20143  size_t testArrayDimensionsSize,
20144  const UA_UInt32 *testArrayDimensions) {
20145  /* No array dimensions defined -> everything is permitted if the value rank fits */
20146  if(constraintArrayDimensionsSize == 0) {
20147  return UA_STATUSCODE_GOOD;
20148  }
20149 
20150  /* Dimension count must match */
20151  if(testArrayDimensionsSize != constraintArrayDimensionsSize)
20153 
20154  /* Dimension lengths must match; zero in the constraint is a wildcard */
20155  for(size_t i = 0; i < constraintArrayDimensionsSize; ++i) {
20156  if(constraintArrayDimensions[i] != testArrayDimensions[i] &&
20157  constraintArrayDimensions[i] != 0)
20159  }
20160  return UA_STATUSCODE_GOOD;
20161 }
20162 
20163 /* Returns the pointer to a datavalue with a possibly transformed type to match
20164  the description */
20165 static const UA_Variant *
20166 convertToMatchingValue(UA_Server *server, const UA_Variant *value,
20167  const UA_NodeId *targetDataTypeId, UA_Variant *editableValue) {
20168  const UA_DataType *targetDataType = UA_findDataType(targetDataTypeId);
20169  if(!targetDataType)
20170  return NULL;
20171 
20172  /* A string is written to a byte array. the valuerank and array
20173  dimensions are checked later */
20174  if(targetDataType == &UA_TYPES[UA_TYPES_BYTE] &&
20175  value->type == &UA_TYPES[UA_TYPES_BYTESTRING] &&
20176  UA_Variant_isScalar(value)) {
20177  UA_ByteString *str = (UA_ByteString*)value->data;
20178  editableValue->storageType = UA_VARIANT_DATA_NODELETE;
20179  editableValue->type = &UA_TYPES[UA_TYPES_BYTE];
20180  editableValue->arrayLength = str->length;
20181  editableValue->data = str->data;
20182  return editableValue;
20183  }
20184 
20185  /* An enum was sent as an int32, or an opaque type as a bytestring. This
20186  * is detected with the typeIndex indicating the "true" datatype. */
20187  enum type_equivalence te1 = typeEquivalence(targetDataType);
20188  enum type_equivalence te2 = typeEquivalence(value->type);
20189  if(te1 != TYPE_EQUIVALENCE_NONE && te1 == te2) {
20190  *editableValue = *value;
20191  editableValue->storageType = UA_VARIANT_DATA_NODELETE;
20192  editableValue->type = targetDataType;
20193  return editableValue;
20194  }
20195 
20196  /* No more possible equivalencies */
20197  return NULL;
20198 }
20199 
20200 /* Test whether the value matches a variable definition given by
20201  * - datatype
20202  * - valueranke
20203  * - array dimensions.
20204  * Sometimes it can be necessary to transform the content of the value, e.g.
20205  * byte array to bytestring or uint32 to some enum. If editableValue is non-NULL,
20206  * we try to create a matching variant that points to the original data. */
20208 typeCheckValue(UA_Server *server, const UA_NodeId *targetDataTypeId,
20209  UA_Int32 targetValueRank, size_t targetArrayDimensionsSize,
20210  const UA_UInt32 *targetArrayDimensions, const UA_Variant *value,
20211  const UA_NumericRange *range, UA_Variant *editableValue) {
20212  /* Empty variant is only allowed for BaseDataType */
20213  if(!value->type)
20214  goto check_array;
20215 
20216  /* See if the types match. The nodeid on the wire may be != the nodeid in
20217  * the node for opaque types, enums and bytestrings. value contains the
20218  * correct type definition after the following paragraph */
20219  if(UA_NodeId_equal(&value->type->typeId, targetDataTypeId))
20220  goto check_array;
20221 
20222  /* Has the value a subtype of the required type? */
20223  const UA_NodeId subtypeId = UA_NODEID_NUMERIC(0, UA_NS0ID_HASSUBTYPE);
20224  if(isNodeInTree(server->nodestore, &value->type->typeId, targetDataTypeId, &subtypeId, 1))
20225  goto check_array;
20226 
20227  /* Try to convert to a matching value if this is wanted */
20228  if(!editableValue)
20230  value = convertToMatchingValue(server, value, targetDataTypeId, editableValue);
20231  if(!value)
20233 
20234  check_array:
20235  if(range) /* array dimensions are checked later when writing the range */
20236  return UA_STATUSCODE_GOOD;
20237 
20238  size_t valueArrayDimensionsSize = value->arrayDimensionsSize;
20239  UA_UInt32 *valueArrayDimensions = value->arrayDimensions;
20240  UA_UInt32 tempArrayDimensions;
20241  if(valueArrayDimensions == 0 && !UA_Variant_isScalar(value)) {
20242  valueArrayDimensionsSize = 1;
20243  tempArrayDimensions = (UA_UInt32)value->arrayLength;
20244  valueArrayDimensions = &tempArrayDimensions;
20245  }
20246 
20247  /* See if the array dimensions match. When arrayDimensions are defined, they
20248  * already hold the valuerank. */
20249  if(targetArrayDimensionsSize > 0)
20250  return compatibleArrayDimensions(targetArrayDimensionsSize, targetArrayDimensions,
20251  valueArrayDimensionsSize, valueArrayDimensions);
20252 
20253  /* Check if the valuerank allows for the value dimension */
20254  return compatibleValueRankValue(targetValueRank, value);
20255 }
20256 
20257 /*****************************/
20258 /* ArrayDimensions Attribute */
20259 /*****************************/
20260 
20261 static UA_StatusCode
20262 readArrayDimensionsAttribute(const UA_VariableNode *vn, UA_DataValue *v) {
20263  UA_Variant_setArray(&v->value, vn->arrayDimensions,
20264  vn->arrayDimensionsSize, &UA_TYPES[UA_TYPES_UINT32]);
20266  v->hasValue = true;
20267  return UA_STATUSCODE_GOOD;
20268 }
20269 
20270 static UA_StatusCode
20271 writeArrayDimensionsAttribute(UA_Server *server, UA_VariableNode *node,
20272  size_t arrayDimensionsSize, UA_UInt32 *arrayDimensions) {
20273  /* If this is a variabletype, there must be no instances or subtypes of it
20274  * when we do the change */
20275  if(node->nodeClass == UA_NODECLASS_VARIABLETYPE &&
20276  UA_Node_hasSubTypeOrInstances((const UA_Node*)node))
20278 
20279  /* Check that the array dimensions match with the valuerank */
20280  UA_StatusCode retval = compatibleValueRankArrayDimensions(node->valueRank, arrayDimensionsSize);
20281  if(retval != UA_STATUSCODE_GOOD) {
20282  UA_LOG_DEBUG(server->config.logger, UA_LOGCATEGORY_SERVER,
20283  "The current value rank does not match the new array dimensions");
20284  return retval;
20285  }
20286 
20287  /* Get the VariableType */
20288  const UA_VariableTypeNode *vt = getVariableNodeType(server, (UA_VariableNode*)node);
20289  if(!vt)
20291 
20292  /* Check if the array dimensions match with the wildcards in the
20293  * variabletype (dimension length 0) */
20294  if(vt->arrayDimensions) {
20295  retval = compatibleArrayDimensions(vt->arrayDimensionsSize, vt->arrayDimensions,
20296  arrayDimensionsSize, arrayDimensions);
20297  if(retval != UA_STATUSCODE_GOOD) {
20298  UA_LOG_DEBUG(server->config.logger, UA_LOGCATEGORY_SERVER,
20299  "Array dimensions in the variable type do not match");
20300  return retval;
20301  }
20302  }
20303 
20304  /* Check if the current value is compatible with the array dimensions */
20305  UA_DataValue value;
20306  UA_DataValue_init(&value);
20307  retval = readValueAttribute(server, node, &value);
20308  if(retval != UA_STATUSCODE_GOOD)
20309  return retval;
20310  if(value.hasValue) {
20311  retval = compatibleArrayDimensions(arrayDimensionsSize, arrayDimensions,
20312  value.value.arrayDimensionsSize,
20313  value.value.arrayDimensions);
20314  UA_DataValue_deleteMembers(&value);
20315  if(retval != UA_STATUSCODE_GOOD) {
20316  UA_LOG_DEBUG(server->config.logger, UA_LOGCATEGORY_SERVER,
20317  "Array dimensions in the current value do not match");
20318  return retval;
20319  }
20320  }
20321 
20322  /* Ok, apply */
20323  UA_UInt32 *oldArrayDimensions = node->arrayDimensions;
20324  retval = UA_Array_copy(arrayDimensions, arrayDimensionsSize,
20325  (void**)&node->arrayDimensions, &UA_TYPES[UA_TYPES_UINT32]);
20326  if(retval != UA_STATUSCODE_GOOD)
20327  return retval;
20328  UA_free(oldArrayDimensions);
20329  node->arrayDimensionsSize = arrayDimensionsSize;
20330  return UA_STATUSCODE_GOOD;
20331 }
20332 
20333 /***********************/
20334 /* ValueRank Attribute */
20335 /***********************/
20336 
20337 static UA_StatusCode
20338 writeValueRankAttributeWithVT(UA_Server *server, UA_VariableNode *node,
20339  UA_Int32 valueRank) {
20340  const UA_VariableTypeNode *vt = getVariableNodeType(server, node);
20341  if(!vt)
20343  return writeValueRankAttribute(server, node, valueRank, vt->valueRank);
20344 }
20345 
20347 writeValueRankAttribute(UA_Server *server, UA_VariableNode *node, UA_Int32 valueRank,
20348  UA_Int32 constraintValueRank) {
20349  /* If this is a variabletype, there must be no instances or subtypes of it
20350  when we do the change */
20351  if(node->nodeClass == UA_NODECLASS_VARIABLETYPE &&
20352  UA_Node_hasSubTypeOrInstances((const UA_Node*)node))
20354 
20355  /* Check if the valuerank of the variabletype allows the change. */
20356  switch(constraintValueRank) {
20357  case -3: /* the value can be a scalar or a one dimensional array */
20358  if(valueRank != -1 && valueRank != 1)
20360  break;
20361  case -2: /* the value can be a scalar or an array with any number of dimensions */
20362  break;
20363  case -1: /* the value is a scalar */
20364  if(valueRank != -1)
20366  break;
20367  case 0: /* the value is an array with one or more dimensions */
20368  if(valueRank < 0)
20370  break;
20371  default: /* >= 1: the value is an array with the specified number of dimensions */
20372  if(valueRank != constraintValueRank)
20374  break;
20375  }
20376 
20377  /* Check if the new valuerank is compatible with the array dimensions. Use
20378  * the read service to handle data sources. */
20379  size_t arrayDims = node->arrayDimensionsSize;
20381  if(arrayDims == 0) {
20382  /* the value could be an array with no arrayDimensions defined.
20383  dimensions zero indicate a scalar for compatibleValueRankArrayDimensions. */
20384  UA_DataValue value;
20385  UA_DataValue_init(&value);
20386  retval = readValueAttribute(server, node, &value);
20387  if(retval != UA_STATUSCODE_GOOD)
20388  return retval;
20389  if(!value.hasValue || value.value.data == NULL)
20390  goto apply; /* no value or null array */
20391  if(!UA_Variant_isScalar(&value.value))
20392  arrayDims = 1;
20393  UA_DataValue_deleteMembers(&value);
20394  }
20395  retval = compatibleValueRankArrayDimensions(valueRank, arrayDims);
20396  if(retval != UA_STATUSCODE_GOOD)
20397  return retval;
20398 
20399  /* All good, apply the change */
20400  apply:
20401  node->valueRank = valueRank;
20402  return UA_STATUSCODE_GOOD;
20403 }
20404 
20405 /**********************/
20406 /* DataType Attribute */
20407 /**********************/
20408 
20409 static UA_StatusCode
20410 writeDataTypeAttributeWithVT(UA_Server *server, UA_VariableNode *node,
20411  const UA_NodeId *dataType) {
20412  const UA_VariableTypeNode *vt = getVariableNodeType(server, node);
20413  if(!vt)
20415  return writeDataTypeAttribute(server, node, dataType, &vt->dataType);
20416 }
20417 
20418 /* constraintDataType can be NULL, then we retrieve the vt */
20420 writeDataTypeAttribute(UA_Server *server, UA_VariableNode *node,
20421  const UA_NodeId *dataType, const UA_NodeId *constraintDataType) {
20422  /* If this is a variabletype, there must be no instances or subtypes of it
20423  when we do the change */
20424  if(node->nodeClass == UA_NODECLASS_VARIABLETYPE &&
20425  UA_Node_hasSubTypeOrInstances((const UA_Node*)node))
20427 
20428  /* Does the new type match the constraints of the variabletype? */
20429  UA_NodeId subtypeId = UA_NODEID_NUMERIC(0, UA_NS0ID_HASSUBTYPE);
20430  if(!isNodeInTree(server->nodestore, dataType,
20431  constraintDataType, &subtypeId, 1))
20433 
20434  /* Check if the current value would match the new type */
20435  UA_DataValue value;
20436  UA_DataValue_init(&value);
20437  UA_StatusCode retval = readValueAttribute(server, node, &value);
20438  if(retval != UA_STATUSCODE_GOOD)
20439  return retval;
20440  if(value.hasValue) {
20441  retval = typeCheckValue(server, dataType, node->valueRank,
20442  node->arrayDimensionsSize, node->arrayDimensions,
20443  &value.value, NULL, NULL);
20444  UA_DataValue_deleteMembers(&value);
20445  if(retval != UA_STATUSCODE_GOOD) {
20446  UA_LOG_DEBUG(server->config.logger, UA_LOGCATEGORY_SERVER,
20447  "The current value does not match the new data type");
20448  return retval;
20449  }
20450  }
20451 
20452  /* Replace the datatype nodeid */
20453  UA_NodeId dtCopy = node->dataType;
20454  retval = UA_NodeId_copy(dataType, &node->dataType);
20455  if(retval != UA_STATUSCODE_GOOD) {
20456  node->dataType = dtCopy;
20457  return retval;
20458  }
20459  UA_NodeId_deleteMembers(&dtCopy);
20460  return UA_STATUSCODE_GOOD;
20461 }
20462 
20463 /*******************/
20464 /* Value Attribute */
20465 /*******************/
20466 
20467 static UA_StatusCode
20468 readValueAttributeFromNode(UA_Server *server, const UA_VariableNode *vn, UA_DataValue *v,
20469  UA_NumericRange *rangeptr) {
20470  if(vn->value.data.callback.onRead) {
20471  UA_RCU_UNLOCK();
20472  vn->value.data.callback.onRead(vn->value.data.callback.handle,
20473  vn->nodeId, &vn->value.data.value.value, rangeptr);
20474  UA_RCU_LOCK();
20475 #ifdef UA_ENABLE_MULTITHREADING
20476  /* Reopen the node to see the changes (multithreading only) */
20477  vn = (const UA_VariableNode*)UA_NodeStore_get(server->nodestore, &vn->nodeId);
20478 #endif
20479  }
20480  if(rangeptr)
20481  return UA_Variant_copyRange(&vn->value.data.value.value, &v->value, *rangeptr);
20482  *v = vn->value.data.value;
20484  return UA_STATUSCODE_GOOD;
20485 }
20486 
20487 static UA_StatusCode
20488 readValueAttributeFromDataSource(const UA_VariableNode *vn, UA_DataValue *v,
20489  UA_TimestampsToReturn timestamps,
20490  UA_NumericRange *rangeptr) {
20491  if(!vn->value.dataSource.read)
20493  UA_Boolean sourceTimeStamp = (timestamps == UA_TIMESTAMPSTORETURN_SOURCE ||
20494  timestamps == UA_TIMESTAMPSTORETURN_BOTH);
20495 
20496  UA_RCU_UNLOCK();
20497  UA_StatusCode retval =
20498  vn->value.dataSource.read(vn->value.dataSource.handle, vn->nodeId,
20499  sourceTimeStamp, rangeptr, v);
20500  UA_RCU_LOCK();
20501  return retval;
20502 }
20503 
20504 static UA_StatusCode
20505 readValueAttributeComplete(UA_Server *server, const UA_VariableNode *vn,
20506  UA_TimestampsToReturn timestamps, const UA_String *indexRange,
20507  UA_DataValue *v) {
20508  /* Compute the index range */
20509  UA_NumericRange range;
20510  UA_NumericRange *rangeptr = NULL;
20512  if(indexRange && indexRange->length > 0) {
20513  retval = parse_numericrange(indexRange, &range);
20514  if(retval != UA_STATUSCODE_GOOD)
20515  return retval;
20516  rangeptr = &range;
20517  }
20518 
20519  /* Read the value */
20520  if(vn->valueSource == UA_VALUESOURCE_DATA)
20521  retval = readValueAttributeFromNode(server, vn, v, rangeptr);
20522  else
20523  retval = readValueAttributeFromDataSource(vn, v, timestamps, rangeptr);
20524 
20525  /* Clean up */
20526  if(rangeptr)
20527  UA_free(range.dimensions);
20528  return retval;
20529 }
20530 
20532 readValueAttribute(UA_Server *server, const UA_VariableNode *vn, UA_DataValue *v) {
20533  return readValueAttributeComplete(server, vn, UA_TIMESTAMPSTORETURN_NEITHER, NULL, v);
20534 }
20535 
20536 static UA_StatusCode
20537 writeValueAttributeWithoutRange(UA_VariableNode *node, const UA_DataValue *value) {
20538  UA_DataValue old_value = node->value.data.value; /* keep the pointers for restoring */
20539  UA_StatusCode retval = UA_DataValue_copy(value, &node->value.data.value);
20540  if(retval == UA_STATUSCODE_GOOD)
20541  UA_DataValue_deleteMembers(&old_value);
20542  else
20543  node->value.data.value = old_value;
20544  return retval;
20545 }
20546 
20547 static UA_StatusCode
20548 writeValueAttributeWithRange(UA_VariableNode *node, const UA_DataValue *value,
20549  const UA_NumericRange *rangeptr) {
20550  /* Value on both sides? */
20551  if(value->status != node->value.data.value.status ||
20552  !value->hasValue || !node->value.data.value.hasValue)
20554 
20555  /* Make scalar a one-entry array for range matching */
20556  UA_Variant editableValue;
20557  const UA_Variant *v = &value->value;
20558  if(UA_Variant_isScalar(&value->value)) {
20559  editableValue = value->value;
20560  editableValue.arrayLength = 1;
20561  v = &editableValue;
20562  }
20563 
20564  /* Write the value */
20565  UA_StatusCode retval = UA_Variant_setRangeCopy(&node->value.data.value.value,
20566  v->data, v->arrayLength, *rangeptr);
20567  if(retval != UA_STATUSCODE_GOOD)
20568  return retval;
20569 
20570  /* Write the status and timestamps */
20571  node->value.data.value.hasStatus = value->hasStatus;
20572  node->value.data.value.status = value->status;
20573  node->value.data.value.hasSourceTimestamp = value->hasSourceTimestamp;
20574  node->value.data.value.sourceTimestamp = value->sourceTimestamp;
20575  node->value.data.value.hasSourcePicoseconds = value->hasSourcePicoseconds;
20576  node->value.data.value.sourcePicoseconds = value->sourcePicoseconds;
20577  return UA_STATUSCODE_GOOD;
20578 }
20579 
20581 writeValueAttribute(UA_Server *server, UA_VariableNode *node,
20582  const UA_DataValue *value, const UA_String *indexRange) {
20583  /* Parse the range */
20584  UA_NumericRange range;
20585  UA_NumericRange *rangeptr = NULL;
20587  if(indexRange && indexRange->length > 0) {
20588  retval = parse_numericrange(indexRange, &range);
20589  if(retval != UA_STATUSCODE_GOOD)
20590  return retval;
20591  rangeptr = &range;
20592  }
20593 
20594  /* Copy the value into an editable "container" where e.g. the datatype can
20595  * be adjusted. The data itself is not written into. */
20596  UA_DataValue editableValue = *value;
20597  editableValue.value.storageType = UA_VARIANT_DATA_NODELETE;
20598 
20599  /* Type checking. May change the type of editableValue */
20600  if(value->hasValue) {
20601  retval = typeCheckValue(server, &node->dataType, node->valueRank,
20602  node->arrayDimensionsSize, node->arrayDimensions,
20603  &value->value, rangeptr, &editableValue.value);
20604  if(retval != UA_STATUSCODE_GOOD)
20605  goto cleanup;
20606  }
20607 
20608  /* Set the source timestamp if there is none */
20609  if(!editableValue.hasSourceTimestamp) {
20610  editableValue.sourceTimestamp = UA_DateTime_now();
20611  editableValue.hasSourceTimestamp = true;
20612  }
20613 
20614  /* Ok, do it */
20615  if(node->valueSource == UA_VALUESOURCE_DATA) {
20616  if(!rangeptr)
20617  retval = writeValueAttributeWithoutRange(node, &editableValue);
20618  else
20619  retval = writeValueAttributeWithRange(node, &editableValue, rangeptr);
20620 
20621  /* Callback after writing */
20622  if(retval == UA_STATUSCODE_GOOD && node->value.data.callback.onWrite) {
20623  const UA_VariableNode *writtenNode;
20624 #ifdef UA_ENABLE_MULTITHREADING
20625  /* Reopen the node to see the changes (multithreading only) */
20626  writtenNode = (const UA_VariableNode*)UA_NodeStore_get(server->nodestore, &node->nodeId);
20627 #else
20628  writtenNode = node; /* The node is written in-situ (TODO: this might
20629  change with the nodestore plugin approach) */
20630 #endif
20631  UA_RCU_UNLOCK();
20632  writtenNode->value.data.callback.onWrite(writtenNode->value.data.callback.handle,
20633  writtenNode->nodeId,
20634  &writtenNode->value.data.value.value, rangeptr);
20635  UA_RCU_LOCK();
20636  }
20637  } else {
20638  if(node->value.dataSource.write) {
20639  UA_RCU_UNLOCK();
20640  retval = node->value.dataSource.write(node->value.dataSource.handle,
20641  node->nodeId, &editableValue.value, rangeptr);
20642  UA_RCU_LOCK();
20643  } else {
20645  }
20646  }
20647 
20648  /* Clean up */
20649  cleanup:
20650  if(rangeptr)
20651  UA_free(range.dimensions);
20652  return retval;
20653 }
20654 
20655 /************************/
20656 /* IsAbstract Attribute */
20657 /************************/
20658 
20659 static UA_StatusCode
20660 readIsAbstractAttribute(const UA_Node *node, UA_Variant *v) {
20661  const UA_Boolean *isAbstract;
20662  switch(node->nodeClass) {
20664  isAbstract = &((const UA_ReferenceTypeNode*)node)->isAbstract;
20665  break;
20667  isAbstract = &((const UA_ObjectTypeNode*)node)->isAbstract;
20668  break;
20670  isAbstract = &((const UA_VariableTypeNode*)node)->isAbstract;
20671  break;
20672  case UA_NODECLASS_DATATYPE:
20673  isAbstract = &((const UA_DataTypeNode*)node)->isAbstract;
20674  break;
20675  default:
20677  }
20678  forceVariantSetScalar(v, isAbstract, &UA_TYPES[UA_TYPES_BOOLEAN]);
20679  return UA_STATUSCODE_GOOD;
20680 }
20681 
20682 static UA_StatusCode
20683 writeIsAbstractAttribute(UA_Node *node, UA_Boolean value) {
20684  switch(node->nodeClass) {
20686  ((UA_ObjectTypeNode*)node)->isAbstract = value;
20687  break;
20689  ((UA_ReferenceTypeNode*)node)->isAbstract = value;
20690  break;
20692  ((UA_VariableTypeNode*)node)->isAbstract = value;
20693  break;
20694  case UA_NODECLASS_DATATYPE:
20695  ((UA_DataTypeNode*)node)->isAbstract = value;
20696  break;
20697  default:
20699  }
20700  return UA_STATUSCODE_GOOD;
20701 }
20702 
20703 /****************/
20704 /* Read Service */
20705 /****************/
20706 
20707 static const UA_String binEncoding = {sizeof("Default Binary")-1, (UA_Byte*)"Default Binary"};
20708 /* static const UA_String xmlEncoding = {sizeof("Default Xml")-1, (UA_Byte*)"Default Xml"}; */
20709 
20710 #define CHECK_NODECLASS(CLASS) \
20711  if(!(node->nodeClass & (CLASS))) { \
20712  retval = UA_STATUSCODE_BADATTRIBUTEIDINVALID; \
20713  break; \
20714  }
20715 
20716 void Service_Read_single(UA_Server *server, UA_Session *session,
20717  const UA_TimestampsToReturn timestamps,
20718  const UA_ReadValueId *id, UA_DataValue *v) {
20719  UA_LOG_DEBUG_SESSION(server->config.logger, session,
20720  "Read the attribute %i", id->attributeId);
20721 
20722  /* XML encoding is not supported */
20723  if(id->dataEncoding.name.length > 0 &&
20724  !UA_String_equal(&binEncoding, &id->dataEncoding.name)) {
20725  v->hasStatus = true;
20727  return;
20728  }
20729 
20730  /* Index range for an attribute other than value */
20731  if(id->indexRange.length > 0 && id->attributeId != UA_ATTRIBUTEID_VALUE) {
20732  v->hasStatus = true;
20734  return;
20735  }
20736 
20737  /* Get the node */
20738  const UA_Node *node = UA_NodeStore_get(server->nodestore, &id->nodeId);
20739  if(!node) {
20740  v->hasStatus = true;
20742  return;
20743  }
20744 
20745  /* Read the attribute */
20747  switch(id->attributeId) {
20748  case UA_ATTRIBUTEID_NODEID:
20749  forceVariantSetScalar(&v->value, &node->nodeId, &UA_TYPES[UA_TYPES_NODEID]);
20750  break;
20752  forceVariantSetScalar(&v->value, &node->nodeClass, &UA_TYPES[UA_TYPES_NODECLASS]);
20753  break;
20755  forceVariantSetScalar(&v->value, &node->browseName, &UA_TYPES[UA_TYPES_QUALIFIEDNAME]);
20756  break;
20758  forceVariantSetScalar(&v->value, &node->displayName, &UA_TYPES[UA_TYPES_LOCALIZEDTEXT]);
20759  break;
20761  forceVariantSetScalar(&v->value, &node->description, &UA_TYPES[UA_TYPES_LOCALIZEDTEXT]);
20762  break;
20764  forceVariantSetScalar(&v->value, &node->writeMask, &UA_TYPES[UA_TYPES_UINT32]);
20765  break;
20767  forceVariantSetScalar(&v->value, &node->userWriteMask, &UA_TYPES[UA_TYPES_UINT32]);
20768  break;
20770  retval = readIsAbstractAttribute(node, &v->value);
20771  break;
20774  forceVariantSetScalar(&v->value, &((const UA_ReferenceTypeNode*)node)->symmetric,
20776  break;
20779  forceVariantSetScalar(&v->value, &((const UA_ReferenceTypeNode*)node)->inverseName,
20780  &UA_TYPES[UA_TYPES_LOCALIZEDTEXT]);
20781  break;
20784  forceVariantSetScalar(&v->value, &((const UA_ViewNode*)node)->containsNoLoops,
20785  &UA_TYPES[UA_TYPES_BOOLEAN]);
20786  break;
20789  forceVariantSetScalar(&v->value, &((const UA_ViewNode*)node)->eventNotifier,
20791  break;
20792  case UA_ATTRIBUTEID_VALUE:
20794  retval = readValueAttributeComplete(server, (const UA_VariableNode*)node,
20795  timestamps, &id->indexRange, v);
20796  break;
20799  forceVariantSetScalar(&v->value, &((const UA_VariableTypeNode*)node)->dataType,
20800  &UA_TYPES[UA_TYPES_NODEID]);
20801  break;
20804  forceVariantSetScalar(&v->value, &((const UA_VariableTypeNode*)node)->valueRank,
20806  break;
20809  retval = readArrayDimensionsAttribute((const UA_VariableNode*)node, v);
20810  break;
20813  forceVariantSetScalar(&v->value, &((const UA_VariableNode*)node)->accessLevel,
20814  &UA_TYPES[UA_TYPES_BYTE]);
20815  break;
20818  forceVariantSetScalar(&v->value, &((const UA_VariableNode*)node)->userAccessLevel,
20819  &UA_TYPES[UA_TYPES_BYTE]);
20820  break;
20823  forceVariantSetScalar(&v->value, &((const UA_VariableNode*)node)->minimumSamplingInterval,
20825  break;
20828  forceVariantSetScalar(&v->value, &((const UA_VariableNode*)node)->historizing,
20829  &UA_TYPES[UA_TYPES_BOOLEAN]);
20830  break;
20833  forceVariantSetScalar(&v->value, &((const UA_MethodNode*)node)->executable,
20834  &UA_TYPES[UA_TYPES_BOOLEAN]);
20835  break;
20838  forceVariantSetScalar(&v->value, &((const UA_MethodNode*)node)->userExecutable,
20839  &UA_TYPES[UA_TYPES_BOOLEAN]);
20840  break;
20841  default:
20843  }
20844 
20845  /* Return error code when reading has failed */
20846  if(retval != UA_STATUSCODE_GOOD) {
20847  v->hasStatus = true;
20848  v->status = retval;
20849  return;
20850  }
20851 
20852  v->hasValue = true;
20853 
20854  /* Create server timestamp */
20855  if(timestamps == UA_TIMESTAMPSTORETURN_SERVER ||
20856  timestamps == UA_TIMESTAMPSTORETURN_BOTH) {
20858  v->hasServerTimestamp = true;
20859  }
20860 
20861  /* Handle source time stamp */
20862  if(id->attributeId == UA_ATTRIBUTEID_VALUE) {
20863  if (timestamps == UA_TIMESTAMPSTORETURN_SERVER ||
20864  timestamps == UA_TIMESTAMPSTORETURN_NEITHER) {
20865  v->hasSourceTimestamp = false;
20866  v->hasSourcePicoseconds = false;
20867  } else if(!v->hasSourceTimestamp) {
20869  v->hasSourceTimestamp = true;
20870  }
20871  }
20872 }
20873 
20874 void Service_Read(UA_Server *server, UA_Session *session,
20875  const UA_ReadRequest *request, UA_ReadResponse *response) {
20876  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing ReadRequest");
20877  if(request->nodesToReadSize <= 0) {
20879  return;
20880  }
20881 
20882  /* check if the timestampstoreturn is valid */
20885  return;
20886  }
20887 
20888  size_t size = request->nodesToReadSize;
20889  response->results = UA_Array_new(size, &UA_TYPES[UA_TYPES_DATAVALUE]);
20890  if(!response->results) {
20892  return;
20893  }
20894  response->resultsSize = size;
20895 
20896  if(request->maxAge < 0) {
20898  return;
20899  }
20900 
20901  for(size_t i = 0;i < size;++i) {
20902  Service_Read_single(server, session, request->timestampsToReturn,
20903  &request->nodesToRead[i], &response->results[i]);
20904  }
20905 
20906 #ifdef UA_ENABLE_NONSTANDARD_STATELESS
20907  /* Add an expiry header for caching */
20908  if(session->sessionId.namespaceIndex == 0 &&
20910  session->sessionId.identifier.numeric == 0){
20911  UA_ExtensionObject additionalHeader;
20912  UA_ExtensionObject_init(&additionalHeader);
20914  additionalHeader.content.encoded.typeId =UA_TYPES[UA_TYPES_VARIANT].typeId;
20915 
20916  UA_Variant variant;
20917  UA_Variant_init(&variant);
20918 
20919  UA_DateTime* expireArray = NULL;
20920  expireArray = UA_Array_new(request->nodesToReadSize,
20922  variant.data = expireArray;
20923 
20924  /* expires in 20 seconds */
20925  for(UA_UInt32 i = 0;i < response->resultsSize;++i) {
20926  expireArray[i] = UA_DateTime_now() + 20 * 100 * 1000 * 1000;
20927  }
20928  UA_Variant_setArray(&variant, expireArray, request->nodesToReadSize,
20929  &UA_TYPES[UA_TYPES_DATETIME]);
20930 
20931  size_t offset = 0;
20932  UA_ByteString str;
20933  size_t strlength = UA_calcSizeBinary(&variant, &UA_TYPES[UA_TYPES_VARIANT]);
20934  UA_ByteString_allocBuffer(&str, strlength);
20935  /* No chunking callback for the encoding */
20936  UA_StatusCode retval = UA_encodeBinary(&variant, &UA_TYPES[UA_TYPES_VARIANT],
20937  NULL, NULL, &str, &offset);
20938  UA_Array_delete(expireArray, request->nodesToReadSize, &UA_TYPES[UA_TYPES_DATETIME]);
20939  if(retval == UA_STATUSCODE_GOOD){
20940  additionalHeader.content.encoded.body.data = str.data;
20941  additionalHeader.content.encoded.body.length = offset;
20942  response->responseHeader.additionalHeader = additionalHeader;
20943  }
20944  }
20945 #endif
20946 }
20947 
20948 /* Exposes the Read service to local users */
20950 UA_Server_read(UA_Server *server, const UA_ReadValueId *item,
20951  UA_TimestampsToReturn timestamps) {
20952  UA_DataValue dv;
20953  UA_DataValue_init(&dv);
20954  UA_RCU_LOCK();
20955  Service_Read_single(server, &adminSession, timestamps, item, &dv);
20956  UA_RCU_UNLOCK();
20957  return dv;
20958 }
20959 
20960 /* Used in inline functions exposing the Read service with more syntactic sugar
20961  * for individual attributes */
20963 __UA_Server_read(UA_Server *server, const UA_NodeId *nodeId,
20964  const UA_AttributeId attributeId, void *v) {
20965  /* Call the read service */
20966  UA_ReadValueId item;
20967  UA_ReadValueId_init(&item);
20968  item.nodeId = *nodeId;
20969  item.attributeId = attributeId;
20971 
20972  /* Check the return value */
20974  if(dv.hasStatus)
20975  retval = dv.status;
20976  else if(!dv.hasValue)
20978  if(retval != UA_STATUSCODE_GOOD) {
20979  UA_DataValue_deleteMembers(&dv);
20980  return retval;
20981  }
20982 
20983  /* Prepare the result */
20984  if(attributeId == UA_ATTRIBUTEID_VALUE ||
20985  attributeId == UA_ATTRIBUTEID_ARRAYDIMENSIONS) {
20986  /* Return the entire variant */
20988  retval = UA_Variant_copy(&dv.value, v);
20989  } else {
20990  /* storageType is UA_VARIANT_DATA. Copy the entire variant
20991  * (including pointers and all) */
20992  memcpy(v, &dv.value, sizeof(UA_Variant));
20993  }
20994  } else {
20995  /* Return the variant content only */
20997  retval = UA_copy(dv.value.data, v, dv.value.type);
20998  } else {
20999  /* storageType is UA_VARIANT_DATA. Copy the content of the type
21000  * (including pointers and all) */
21001  memcpy(v, dv.value.data, dv.value.type->memSize);
21002  /* Delete the "carrier" in the variant */
21003  UA_free(dv.value.data);
21004  }
21005  }
21006  return retval;
21007 }
21008 
21009 /*****************/
21010 /* Write Service */
21011 /*****************/
21012 
21013 #define CHECK_DATATYPE_SCALAR(EXP_DT) \
21014  if(!wvalue->value.hasValue || \
21015  &UA_TYPES[UA_TYPES_##EXP_DT] != wvalue->value.value.type || \
21016  !UA_Variant_isScalar(&wvalue->value.value)) { \
21017  retval = UA_STATUSCODE_BADTYPEMISMATCH; \
21018  break; \
21019  }
21020 
21021 #define CHECK_DATATYPE_ARRAY(EXP_DT) \
21022  if(!wvalue->value.hasValue || \
21023  &UA_TYPES[UA_TYPES_##EXP_DT] != wvalue->value.value.type || \
21024  UA_Variant_isScalar(&wvalue->value.value)) { \
21025  retval = UA_STATUSCODE_BADTYPEMISMATCH; \
21026  break; \
21027  }
21028 
21029 #define CHECK_NODECLASS_WRITE(CLASS) \
21030  if((node->nodeClass & (CLASS)) == 0) { \
21031  retval = UA_STATUSCODE_BADNODECLASSINVALID; \
21032  break; \
21033  }
21034 
21035 /* This function implements the main part of the write service and operates on a
21036  copy of the node (not in single-threaded mode). */
21037 static UA_StatusCode
21038 CopyAttributeIntoNode(UA_Server *server, UA_Session *session,
21039  UA_Node *node, const UA_WriteValue *wvalue) {
21040  const void *value = wvalue->value.value.data;
21042  switch(wvalue->attributeId) {
21043  case UA_ATTRIBUTEID_NODEID:
21046  break;
21048  CHECK_DATATYPE_SCALAR(QUALIFIEDNAME);
21049  UA_QualifiedName_deleteMembers(&node->browseName);
21050  UA_QualifiedName_copy(value, &node->browseName);
21051  break;
21053  CHECK_DATATYPE_SCALAR(LOCALIZEDTEXT);
21054  UA_LocalizedText_deleteMembers(&node->displayName);
21055  UA_LocalizedText_copy(value, &node->displayName);
21056  break;
21058  CHECK_DATATYPE_SCALAR(LOCALIZEDTEXT);
21059  UA_LocalizedText_deleteMembers(&node->description);
21060  UA_LocalizedText_copy(value, &node->description);
21061  break;
21063  CHECK_DATATYPE_SCALAR(UINT32);
21064  node->writeMask = *(const UA_UInt32*)value;
21065  break;
21067  CHECK_DATATYPE_SCALAR(UINT32);
21068  node->userWriteMask = *(const UA_UInt32*)value;
21069  break;
21071  CHECK_DATATYPE_SCALAR(BOOLEAN);
21072  retval = writeIsAbstractAttribute(node, *(const UA_Boolean*)value);
21073  break;
21076  CHECK_DATATYPE_SCALAR(BOOLEAN);
21077  ((UA_ReferenceTypeNode*)node)->symmetric = *(const UA_Boolean*)value;
21078  break;
21081  CHECK_DATATYPE_SCALAR(LOCALIZEDTEXT);
21082  UA_LocalizedText_deleteMembers(&((UA_ReferenceTypeNode*)node)->inverseName);
21083  UA_LocalizedText_copy(value, &((UA_ReferenceTypeNode*)node)->inverseName);
21084  break;
21087  CHECK_DATATYPE_SCALAR(BOOLEAN);
21088  ((UA_ViewNode*)node)->containsNoLoops = *(const UA_Boolean*)value;
21089  break;
21092  CHECK_DATATYPE_SCALAR(BYTE);
21093  ((UA_ViewNode*)node)->eventNotifier = *(const UA_Byte*)value;
21094  break;
21095  case UA_ATTRIBUTEID_VALUE:
21097  retval = writeValueAttribute(server, (UA_VariableNode*)node,
21098  &wvalue->value, &wvalue->indexRange);
21099  break;
21102  CHECK_DATATYPE_SCALAR(NODEID);
21103  retval = writeDataTypeAttributeWithVT(server, (UA_VariableNode*)node, (const UA_NodeId*)value);
21104  break;
21107  CHECK_DATATYPE_SCALAR(INT32);
21108  retval = writeValueRankAttributeWithVT(server, (UA_VariableNode*)node, *(const UA_Int32*)value);
21109  break;
21112  CHECK_DATATYPE_ARRAY(UINT32);
21113  retval = writeArrayDimensionsAttribute(server, (UA_VariableNode*)node,
21114  wvalue->value.value.arrayLength,
21115  wvalue->value.value.data);
21116  break;
21119  CHECK_DATATYPE_SCALAR(BYTE);
21120  ((UA_VariableNode*)node)->accessLevel = *(const UA_Byte*)value;
21121  break;
21124  CHECK_DATATYPE_SCALAR(BYTE);
21125  ((UA_VariableNode*)node)->userAccessLevel = *(const UA_Byte*)value;
21126  break;
21129  CHECK_DATATYPE_SCALAR(DOUBLE);
21130  ((UA_VariableNode*)node)->minimumSamplingInterval = *(const UA_Double*)value;
21131  break;
21134  CHECK_DATATYPE_SCALAR(BOOLEAN);
21135  ((UA_VariableNode*)node)->historizing = *(const UA_Boolean*)value;
21136  break;
21139  CHECK_DATATYPE_SCALAR(BOOLEAN);
21140  ((UA_MethodNode*)node)->executable = *(const UA_Boolean*)value;
21141  break;
21144  CHECK_DATATYPE_SCALAR(BOOLEAN);
21145  ((UA_MethodNode*)node)->userExecutable = *(const UA_Boolean*)value;
21146  break;
21147  default:
21149  break;
21150  }
21151  if(retval != UA_STATUSCODE_GOOD)
21152  UA_LOG_INFO_SESSION(server->config.logger, session,
21153  "WriteRequest returned status code %s",
21154  UA_StatusCode_name(retval));
21155  return retval;
21156 }
21157 
21158 void
21159 Service_Write(UA_Server *server, UA_Session *session,
21160  const UA_WriteRequest *request, UA_WriteResponse *response) {
21161  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing WriteRequest");
21162  if(request->nodesToWriteSize <= 0) {
21164  return;
21165  }
21166 
21168  if(!response->results) {
21170  return;
21171  }
21172  response->resultsSize = request->nodesToWriteSize;
21173 
21174  for(size_t i = 0;i < request->nodesToWriteSize;++i) {
21175  response->results[i] = UA_Server_editNode(server, session, &request->nodesToWrite[i].nodeId,
21176  (UA_EditNodeCallback)CopyAttributeIntoNode,
21177  &request->nodesToWrite[i]);
21178  }
21179 }
21180 
21182 UA_Server_write(UA_Server *server, const UA_WriteValue *value) {
21183  UA_RCU_LOCK();
21184  UA_StatusCode retval =
21185  UA_Server_editNode(server, &adminSession, &value->nodeId,
21186  (UA_EditNodeCallback)CopyAttributeIntoNode, value);
21187  UA_RCU_UNLOCK();
21188  return retval;
21189 }
21190 
21191 /* Convenience function to be wrapped into inline functions */
21193 __UA_Server_write(UA_Server *server, const UA_NodeId *nodeId,
21194  const UA_AttributeId attributeId,
21195  const UA_DataType *attr_type,
21196  const void *attr) {
21197  UA_WriteValue wvalue;
21198  UA_WriteValue_init(&wvalue);
21199  wvalue.nodeId = *nodeId;
21200  wvalue.attributeId = attributeId;
21201  wvalue.value.hasValue = true;
21202  if(attr_type != &UA_TYPES[UA_TYPES_VARIANT]) {
21203  /* hacked cast. the target WriteValue is used as const anyway */
21204  UA_Variant_setScalar(&wvalue.value.value, (void*)(uintptr_t)attr, attr_type);
21205  } else {
21206  wvalue.value.value = *(const UA_Variant*)attr;
21207  }
21208  return UA_Server_write(server, &wvalue);
21209 }
21210 
21211 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_services_nodemanagement.c" ***********************************/
21212 
21213 /* This Source Code Form is subject to the terms of the Mozilla Public
21214  * License, v. 2.0. If a copy of the MPL was not distributed with this
21215  * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
21216 
21217 
21218 /************************/
21219 /* Forward Declarations */
21220 /************************/
21221 
21222 static UA_StatusCode
21223 addReference(UA_Server *server, UA_Session *session,
21224  const UA_AddReferencesItem *item);
21225 
21226 static UA_StatusCode
21227 deleteReference(UA_Server *server, UA_Session *session,
21228  const UA_DeleteReferencesItem *item);
21229 
21230 static UA_StatusCode
21231 deleteNode(UA_Server *server, UA_Session *session,
21232  const UA_NodeId *nodeId, UA_Boolean deleteReferences);
21233 
21234 /**********************/
21235 /* Consistency Checks */
21236 /**********************/
21237 
21238 /* Check if the requested parent node exists, has the right node class and is
21239  * referenced with an allowed (hierarchical) reference type. For "type" nodes,
21240  * only hasSubType references are allowed. */
21241 static UA_StatusCode
21242 checkParentReference(UA_Server *server, UA_Session *session, UA_NodeClass nodeClass,
21243  const UA_NodeId *parentNodeId, const UA_NodeId *referenceTypeId) {
21244  /* Objects do not need a parent (e.g. mandatory/optional modellingrules) */
21245  if(nodeClass == UA_NODECLASS_OBJECT && UA_NodeId_isNull(parentNodeId) &&
21246  UA_NodeId_isNull(referenceTypeId))
21247  return UA_STATUSCODE_GOOD;
21248 
21249  /* See if the parent exists */
21250  const UA_Node *parent = UA_NodeStore_get(server->nodestore, parentNodeId);
21251  if(!parent) {
21252  UA_LOG_INFO_SESSION(server->config.logger, session,
21253  "AddNodes: Parent node not found");
21255  }
21256 
21257  /* Check the referencetype exists */
21258  const UA_ReferenceTypeNode *referenceType =
21259  (const UA_ReferenceTypeNode*)UA_NodeStore_get(server->nodestore, referenceTypeId);
21260  if(!referenceType) {
21261  UA_LOG_INFO_SESSION(server->config.logger, session,
21262  "AddNodes: Reference type to the parent not found");
21264  }
21265 
21266  /* Check if the referencetype is a reference type node */
21267  if(referenceType->nodeClass != UA_NODECLASS_REFERENCETYPE) {
21268  UA_LOG_INFO_SESSION(server->config.logger, session,
21269  "AddNodes: Reference type to the parent invalid");
21271  }
21272 
21273  /* Check that the reference type is not abstract */
21274  if(referenceType->isAbstract == true) {
21275  UA_LOG_INFO_SESSION(server->config.logger, session,
21276  "AddNodes: Abstract reference type to the parent not allowed");
21278  }
21279 
21280  /* Check hassubtype relation for type nodes */
21281  const UA_NodeId subtypeId = UA_NODEID_NUMERIC(0, UA_NS0ID_HASSUBTYPE);
21282  if(nodeClass == UA_NODECLASS_DATATYPE ||
21283  nodeClass == UA_NODECLASS_VARIABLETYPE ||
21284  nodeClass == UA_NODECLASS_OBJECTTYPE ||
21285  nodeClass == UA_NODECLASS_REFERENCETYPE) {
21286  /* type needs hassubtype reference to the supertype */
21287  if(!UA_NodeId_equal(referenceTypeId, &subtypeId)) {
21288  UA_LOG_INFO_SESSION(server->config.logger, session,
21289  "AddNodes: New type node need to have a "
21290  "HasSubType reference");
21292  }
21293  /* supertype needs to be of the same node type */
21294  if(parent->nodeClass != nodeClass) {
21295  UA_LOG_INFO_SESSION(server->config.logger, session,
21296  "AddNodes: New type node needs to be of the same "
21297  "node type as the parent");
21299  }
21300  return UA_STATUSCODE_GOOD;
21301  }
21302 
21303  /* Test if the referencetype is hierarchical */
21304  const UA_NodeId hierarchicalReference =
21305  UA_NODEID_NUMERIC(0, UA_NS0ID_HIERARCHICALREFERENCES);
21306  if(!isNodeInTree(server->nodestore, referenceTypeId,
21307  &hierarchicalReference, &subtypeId, 1)) {
21308  UA_LOG_INFO_SESSION(server->config.logger, session,
21309  "AddNodes: Reference type is not hierarchical");
21311  }
21312 
21313  return UA_STATUSCODE_GOOD;
21314 }
21315 
21316 /************/
21317 /* Add Node */
21318 /************/
21319 
21320 static void
21321 Service_AddNodes_single(UA_Server *server, UA_Session *session,
21322  const UA_AddNodesItem *item, UA_AddNodesResult *result,
21323  UA_InstantiationCallback *instantiationCallback);
21324 
21325 static UA_StatusCode
21326 copyChildNodesToNode(UA_Server *server, UA_Session *session,
21327  const UA_NodeId *sourceNodeId, const UA_NodeId *destinationNodeId,
21328  UA_InstantiationCallback *instantiationCallback);
21329 
21330 /* copy an existing variable under the given parent. then instantiate the
21331  * variable for its type */
21332 static UA_StatusCode
21333 copyExistingVariable(UA_Server *server, UA_Session *session, const UA_NodeId *variable,
21334  const UA_NodeId *referenceType, const UA_NodeId *parent,
21335  UA_InstantiationCallback *instantiationCallback) {
21336  const UA_VariableNode *node =
21337  (const UA_VariableNode*)UA_NodeStore_get(server->nodestore, variable);
21338  if(!node)
21340  if(node->nodeClass != UA_NODECLASS_VARIABLE)
21342 
21343  /* Get the current value */
21344  UA_DataValue value;
21345  UA_DataValue_init(&value);
21346  UA_StatusCode retval = readValueAttribute(server, node, &value);
21347  if(retval != UA_STATUSCODE_GOOD)
21348  return retval;
21349 
21350  /* Prepare the variable description */
21351  UA_VariableAttributes attr;
21352  UA_VariableAttributes_init(&attr);
21353  attr.displayName = node->displayName;
21354  attr.description = node->description;
21355  attr.writeMask = node->writeMask;
21356  attr.userWriteMask = node->userWriteMask;
21357  attr.value = value.value;
21358  attr.dataType = node->dataType;
21359  attr.valueRank = node->valueRank;
21360  attr.arrayDimensionsSize = node->arrayDimensionsSize;
21361  attr.arrayDimensions = node->arrayDimensions;
21362  attr.accessLevel = node->accessLevel;
21363  attr.userAccessLevel = node->userAccessLevel;
21365  attr.historizing = node->historizing;
21366 
21367  UA_AddNodesItem item;
21368  UA_AddNodesItem_init(&item);
21370  item.parentNodeId.nodeId = *parent;
21371  item.referenceTypeId = *referenceType;
21372  item.browseName = node->browseName;
21375  item.nodeAttributes.content.decoded.data = &attr;
21376  const UA_VariableTypeNode *vt = (const UA_VariableTypeNode*)getNodeType(server, (const UA_Node*)node);
21377  if(!vt || vt->nodeClass != UA_NODECLASS_VARIABLETYPE || vt->isAbstract) {
21379  goto cleanup;
21380  }
21381  item.typeDefinition.nodeId = vt->nodeId;
21382 
21383  /* Add the variable and instantiate the children */
21384  UA_AddNodesResult res;
21385  UA_AddNodesResult_init(&res);
21386  Service_AddNodes_single(server, session, &item, &res, instantiationCallback);
21387  if(res.statusCode != UA_STATUSCODE_GOOD) {
21388  retval = res.statusCode;
21389  goto cleanup;
21390  }
21391  retval = copyChildNodesToNode(server, session, &node->nodeId,
21392  &res.addedNodeId, instantiationCallback);
21393 
21394  if(retval == UA_STATUSCODE_GOOD && instantiationCallback)
21395  instantiationCallback->method(res.addedNodeId, node->nodeId,
21396  instantiationCallback->handle);
21397 
21398  UA_NodeId_deleteMembers(&res.addedNodeId);
21399  cleanup:
21400  if(value.hasValue && value.value.storageType == UA_VARIANT_DATA)
21401  UA_Variant_deleteMembers(&value.value);
21402  return retval;
21403 }
21404 
21405 /* Copy an existing object under the given parent. Then instantiate for all
21406  * hastypedefinitions of the original version. */
21407 static UA_StatusCode
21408 copyExistingObject(UA_Server *server, UA_Session *session, const UA_NodeId *object,
21409  const UA_NodeId *referenceType, const UA_NodeId *parent,
21410  UA_InstantiationCallback *instantiationCallback) {
21411  const UA_ObjectNode *node =
21412  (const UA_ObjectNode*)UA_NodeStore_get(server->nodestore, object);
21413  if(!node)
21415  if(node->nodeClass != UA_NODECLASS_OBJECT)
21417 
21418  /* Prepare the item */
21419  UA_ObjectAttributes attr;
21420  UA_ObjectAttributes_init(&attr);
21421  attr.displayName = node->displayName;
21422  attr.description = node->description;
21423  attr.writeMask = node->writeMask;
21424  attr.userWriteMask = node->userWriteMask;
21425  attr.eventNotifier = node->eventNotifier;
21426 
21427  UA_AddNodesItem item;
21428  UA_AddNodesItem_init(&item);
21430  item.parentNodeId.nodeId = *parent;
21431  item.referenceTypeId = *referenceType;
21432  item.browseName = node->browseName;
21435  item.nodeAttributes.content.decoded.data = &attr;
21436  const UA_ObjectTypeNode *objtype = (const UA_ObjectTypeNode*)getNodeType(server, (const UA_Node*)node);
21437  if(!objtype || objtype->nodeClass != UA_NODECLASS_OBJECTTYPE || objtype->isAbstract)
21439  item.typeDefinition.nodeId = objtype->nodeId;
21440 
21441  /* add the new object */
21442  UA_AddNodesResult res;
21443  UA_AddNodesResult_init(&res);
21444  Service_AddNodes_single(server, session, &item, &res, instantiationCallback);
21445  if(res.statusCode != UA_STATUSCODE_GOOD)
21446  return res.statusCode;
21447 
21448  /* Copy any aggregated/nested variables/methods/subobjects this object contains
21449  * These objects may not be part of the nodes type. */
21450  UA_StatusCode retval = copyChildNodesToNode(server, session, &node->nodeId,
21451  &res.addedNodeId, instantiationCallback);
21452  if(retval == UA_STATUSCODE_GOOD && instantiationCallback)
21453  instantiationCallback->method(res.addedNodeId, node->nodeId,
21454  instantiationCallback->handle);
21455 
21456  UA_NodeId_deleteMembers(&res.addedNodeId);
21457  return retval;
21458 }
21459 
21460 static UA_StatusCode
21461 setObjectInstanceHandle(UA_Server *server, UA_Session *session,
21462  UA_ObjectNode* node, void * (*constructor)(const UA_NodeId instance)) {
21463  if(node->nodeClass != UA_NODECLASS_OBJECT)
21465  if(!node->instanceHandle)
21466  node->instanceHandle = constructor(node->nodeId);
21467  return UA_STATUSCODE_GOOD;
21468 }
21469 
21470 static UA_StatusCode
21471 instantiateNode(UA_Server *server, UA_Session *session, const UA_NodeId *nodeId,
21472  UA_NodeClass nodeClass, const UA_NodeId *typeId,
21473  UA_InstantiationCallback *instantiationCallback) {
21474  /* see if the type node is correct */
21475  const UA_Node *typenode = UA_NodeStore_get(server->nodestore, typeId);
21476  if(!typenode)
21478  if(nodeClass == UA_NODECLASS_VARIABLE) {
21479  if(typenode->nodeClass != UA_NODECLASS_VARIABLETYPE ||
21480  ((const UA_VariableTypeNode*)typenode)->isAbstract)
21482  } else if(nodeClass == UA_NODECLASS_OBJECT) {
21483  if(typenode->nodeClass != UA_NODECLASS_OBJECTTYPE ||
21484  ((const UA_ObjectTypeNode*)typenode)->isAbstract)
21486  } else {
21488  }
21489 
21490  /* Get the hierarchy of the type and all its supertypes */
21491  UA_NodeId *hierarchy = NULL;
21492  size_t hierarchySize = 0;
21493  UA_StatusCode retval =
21494  getTypeHierarchy(server->nodestore, typenode, true, &hierarchy, &hierarchySize);
21495  if(retval != UA_STATUSCODE_GOOD)
21496  return retval;
21497 
21498  /* Copy members of the type and supertypes */
21499  for(size_t i = 0; i < hierarchySize; ++i)
21500  retval |= copyChildNodesToNode(server, session, &hierarchy[i], nodeId, instantiationCallback);
21501  UA_Array_delete(hierarchy, hierarchySize, &UA_TYPES[UA_TYPES_NODEID]);
21502  if(retval != UA_STATUSCODE_GOOD)
21503  return retval;
21504 
21505  /* Call the object constructor */
21506  if(typenode->nodeClass == UA_NODECLASS_OBJECTTYPE) {
21507  const UA_ObjectLifecycleManagement *olm =
21508  &((const UA_ObjectTypeNode*)typenode)->lifecycleManagement;
21509  if(olm->constructor)
21510  UA_Server_editNode(server, session, nodeId,
21511  (UA_EditNodeCallback)setObjectInstanceHandle,
21512  olm->constructor);
21513  }
21514 
21515  /* Add a hasType reference */
21516  UA_AddReferencesItem addref;
21517  UA_AddReferencesItem_init(&addref);
21518  addref.sourceNodeId = *nodeId;
21519  addref.referenceTypeId = UA_NODEID_NUMERIC(0, UA_NS0ID_HASTYPEDEFINITION);
21520  addref.isForward = true;
21521  addref.targetNodeId.nodeId = *typeId;
21522  return addReference(server, session, &addref);
21523 }
21524 
21525 /* Search for an instance of "browseName" in node searchInstance
21526  * Used during copyChildNodes to find overwritable/mergable nodes */
21527 static UA_StatusCode
21528 instanceFindAggregateByBrowsename(UA_Server *server, UA_Session *session,
21529  const UA_NodeId *searchInstance,
21530  const UA_QualifiedName *browseName,
21531  UA_NodeId *outInstanceNodeId) {
21533  UA_BrowseDescription_init(&bd);
21534  bd.nodeId = *searchInstance;
21535  bd.referenceTypeId = UA_NODEID_NUMERIC(0, UA_NS0ID_AGGREGATES);
21536  bd.includeSubtypes = true;
21540 
21541  UA_BrowseResult br;
21542  UA_BrowseResult_init(&br);
21543  Service_Browse_single(server, session, NULL, &bd, 0, &br);
21544  if(br.statusCode != UA_STATUSCODE_GOOD)
21545  return br.statusCode;
21546 
21548  for(size_t i = 0; i < br.referencesSize; ++i) {
21549  UA_ReferenceDescription *rd = &br.references[i];
21550  if(rd->browseName.namespaceIndex == browseName->namespaceIndex &&
21551  UA_String_equal(&rd->browseName.name, &browseName->name)) {
21552  retval = UA_NodeId_copy(&rd->nodeId.nodeId, outInstanceNodeId);
21553  break;
21554  }
21555  }
21556 
21557  UA_BrowseResult_deleteMembers(&br);
21558  return retval;
21559 }
21560 
21561 static UA_Boolean
21562 mandatoryChild(UA_Server *server, UA_Session *session, const UA_NodeId *childNodeId) {
21563  const UA_NodeId mandatoryId = UA_NODEID_NUMERIC(0, UA_NS0ID_MODELLINGRULE_MANDATORY);
21564  const UA_NodeId hasModellingRuleId = UA_NODEID_NUMERIC(0, UA_NS0ID_HASMODELLINGRULE);
21565 
21566  /* Get the child */
21567  const UA_Node *child = UA_NodeStore_get(server->nodestore, childNodeId);
21568  if(!child)
21569  return false;
21570 
21571  /* Look for the reference making the child mandatory */
21572  for(size_t i = 0; i < child->referencesSize; ++i) {
21573  UA_ReferenceNode *ref = &child->references[i];
21574  if(!UA_NodeId_equal(&hasModellingRuleId, &ref->referenceTypeId))
21575  continue;
21576  if(!UA_NodeId_equal(&mandatoryId, &ref->targetId.nodeId))
21577  continue;
21578  if(ref->isInverse)
21579  continue;
21580  return true;
21581  }
21582  return false;
21583 }
21584 
21585 /* Copy any children of Node sourceNodeId to another node destinationNodeId
21586  * Used at 2 places:
21587  * (1) During instantiation, when any children of the Type are copied
21588  * (2) During instantiation to copy any *nested* instances to the new node
21589  * (2.1) Might call instantiation of a type first
21590  * (2.2) *Should* then overwrite nested contents in definition --> this scenario is currently not handled!
21591  */
21592 static UA_StatusCode
21593 copyChildNodesToNode(UA_Server* server, UA_Session* session,
21594  const UA_NodeId* sourceNodeId, const UA_NodeId* destinationNodeId,
21595  UA_InstantiationCallback* instantiationCallback) {
21596  /* Browse to get all children */
21598  UA_BrowseDescription_init(&bd);
21599  bd.nodeId = *sourceNodeId;
21600  bd.referenceTypeId = UA_NODEID_NUMERIC(0, UA_NS0ID_AGGREGATES);
21601  bd.includeSubtypes = true;
21606 
21607  UA_BrowseResult br;
21608  UA_BrowseResult_init(&br);
21609  Service_Browse_single(server, session, NULL, &bd, 0, &br);
21610  if(br.statusCode != UA_STATUSCODE_GOOD)
21611  return br.statusCode;
21612 
21613  /* Copy all children */
21615  UA_NodeId existingChild = UA_NODEID_NULL;
21616  for(size_t i = 0; i < br.referencesSize; ++i) {
21617  UA_ReferenceDescription *rd = &br.references[i];
21618 
21619  /* Is the child mandatory? If not, skip */
21620  if(!mandatoryChild(server, session, &rd->nodeId.nodeId))
21621  continue;
21622 
21623  /* TODO: If a child is optional, check whether optional children that
21624  * were manually added fit the constraints. */
21625 
21626  /* Check for deduplication */
21627  retval = instanceFindAggregateByBrowsename(server, session, destinationNodeId,
21628  &rd->browseName, &existingChild);
21629  if(retval != UA_STATUSCODE_GOOD)
21630  break;
21631 
21632  if(UA_NodeId_equal(&UA_NODEID_NULL, &existingChild)) {
21633  /* New node in child */
21634  if(rd->nodeClass == UA_NODECLASS_METHOD) {
21635  /* add a reference to the method in the objecttype */
21636  UA_AddReferencesItem newItem;
21637  UA_AddReferencesItem_init(&newItem);
21638  newItem.sourceNodeId = *destinationNodeId;
21639  newItem.referenceTypeId = rd->referenceTypeId;
21640  newItem.isForward = true;
21641  newItem.targetNodeId = rd->nodeId;
21643  retval = addReference(server, session, &newItem);
21644  } else if(rd->nodeClass == UA_NODECLASS_VARIABLE)
21645  retval = copyExistingVariable(server, session, &rd->nodeId.nodeId,
21646  &rd->referenceTypeId, destinationNodeId,
21647  instantiationCallback);
21648  else if(rd->nodeClass == UA_NODECLASS_OBJECT)
21649  retval = copyExistingObject(server, session, &rd->nodeId.nodeId,
21650  &rd->referenceTypeId, destinationNodeId,
21651  instantiationCallback);
21652  } else {
21653  /* Preexistent node in child
21654  * General strategy if we meet an already existing node:
21655  * - Preexistent variable contents always 'win' overwriting anything
21656  * supertypes would instantiate
21657  * - Always copy contents of template *into* existant node (merge
21658  * contents of e.g. Folders like ParameterSet) */
21659  if(rd->nodeClass == UA_NODECLASS_METHOD) {
21660  /* Do nothing, existent method wins */
21661  } else if(rd->nodeClass == UA_NODECLASS_VARIABLE ||
21662  rd->nodeClass == UA_NODECLASS_OBJECT) {
21663  if(!UA_NodeId_equal(&rd->nodeId.nodeId, &existingChild))
21664  retval = copyChildNodesToNode(server, session, &rd->nodeId.nodeId,
21665  &existingChild, instantiationCallback);
21666  }
21667  UA_NodeId_deleteMembers(&existingChild);
21668  }
21669  if(retval != UA_STATUSCODE_GOOD)
21670  break;
21671  }
21672  UA_BrowseResult_deleteMembers(&br);
21673  return retval;
21674 }
21675 
21677 Service_AddNodes_existing(UA_Server *server, UA_Session *session, UA_Node *node,
21678  const UA_NodeId *parentNodeId, const UA_NodeId *referenceTypeId,
21679  const UA_NodeId *typeDefinition,
21680  UA_InstantiationCallback *instantiationCallback,
21681  UA_NodeId *addedNodeId) {
21683 
21684  /* Check the namespaceindex */
21685  if(node->nodeId.namespaceIndex >= server->namespacesSize) {
21686  UA_LOG_INFO_SESSION(server->config.logger, session, "AddNodes: Namespace invalid");
21689  }
21690 
21691  /* Check the reference to the parent */
21692  UA_StatusCode retval = checkParentReference(server, session, node->nodeClass,
21693  parentNodeId, referenceTypeId);
21694  if(retval != UA_STATUSCODE_GOOD) {
21695  UA_LOG_INFO_SESSION(server->config.logger, session,
21696  "AddNodes: Checking the reference to the parent returned "
21697  "error code %s", UA_StatusCode_name(retval));
21699  return retval;
21700  }
21701 
21702  /* Add the node to the nodestore */
21703  retval = UA_NodeStore_insert(server->nodestore, node);
21704  if(retval != UA_STATUSCODE_GOOD) {
21705  UA_LOG_INFO_SESSION(server->config.logger, session,
21706  "AddNodes: Node could not be added to the nodestore "
21707  "with error code %s", UA_StatusCode_name(retval));
21708  return retval;
21709  }
21710 
21711  /* Copy the nodeid if needed */
21712  if(addedNodeId) {
21713  retval = UA_NodeId_copy(&node->nodeId, addedNodeId);
21714  if(retval != UA_STATUSCODE_GOOD) {
21715  UA_LOG_INFO_SESSION(server->config.logger, session,
21716  "AddNodes: Could not copy the nodeid");
21717  goto remove_node;
21718  }
21719  }
21720 
21721  /* Hierarchical reference back to the parent */
21722  if(!UA_NodeId_isNull(parentNodeId)) {
21723  UA_AddReferencesItem item;
21724  UA_AddReferencesItem_init(&item);
21725  item.sourceNodeId = node->nodeId;
21726  item.referenceTypeId = *referenceTypeId;
21727  item.isForward = false;
21728  item.targetNodeId.nodeId = *parentNodeId;
21729  retval = addReference(server, session, &item);
21730  if(retval != UA_STATUSCODE_GOOD) {
21731  UA_LOG_INFO_SESSION(server->config.logger, session,
21732  "AddNodes: Could not add the reference to the parent"
21733  "with error code %s", UA_StatusCode_name(retval));
21734  goto remove_node;
21735  }
21736  }
21737 
21738  /* Fall back to a default typedefinition for variables and objects */
21739  const UA_NodeId basedatavariabletype = UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE);
21740  const UA_NodeId baseobjecttype = UA_NODEID_NUMERIC(0, UA_NS0ID_BASEOBJECTTYPE);
21741  if(node->nodeClass == UA_NODECLASS_VARIABLE ||
21742  node->nodeClass == UA_NODECLASS_OBJECT) {
21743  if(!typeDefinition || UA_NodeId_isNull(typeDefinition)) {
21744  if(node->nodeClass == UA_NODECLASS_VARIABLE)
21745  typeDefinition = &basedatavariabletype;
21746  else
21747  typeDefinition = &baseobjecttype;
21748  }
21749 
21750  /* Instantiate variables and objects */
21751  retval = instantiateNode(server, session, &node->nodeId, node->nodeClass,
21752  typeDefinition, instantiationCallback);
21753  if(retval != UA_STATUSCODE_GOOD) {
21754  UA_LOG_INFO_SESSION(server->config.logger, session,
21755  "AddNodes: Could not instantiate the node with"
21756  "error code %s", UA_StatusCode_name(retval));
21757  goto remove_node;
21758  }
21759  }
21760 
21761  /* Custom callback */
21762  if(instantiationCallback)
21763  instantiationCallback->method(node->nodeId, *typeDefinition,
21764  instantiationCallback->handle);
21765  return UA_STATUSCODE_GOOD;
21766 
21767  remove_node:
21768  deleteNode(server, &adminSession, &node->nodeId, true);
21769  return retval;
21770 }
21771 
21772 /*******************************************/
21773 /* Create nodes from attribute description */
21774 /*******************************************/
21775 
21776 static UA_StatusCode
21777 copyStandardAttributes(UA_Node *node, const UA_AddNodesItem *item,
21778  const UA_NodeAttributes *attr) {
21779  UA_StatusCode retval;
21780  retval = UA_NodeId_copy(&item->requestedNewNodeId.nodeId, &node->nodeId);
21781  retval |= UA_QualifiedName_copy(&item->browseName, &node->browseName);
21782  retval |= UA_LocalizedText_copy(&attr->displayName, &node->displayName);
21783  retval |= UA_LocalizedText_copy(&attr->description, &node->description);
21784  node->writeMask = attr->writeMask;
21785  node->userWriteMask = attr->userWriteMask;
21786  return retval;
21787 }
21788 
21789 static UA_StatusCode
21790 copyCommonVariableAttributes(UA_Server *server, UA_VariableNode *node,
21791  const UA_AddNodesItem *item,
21792  const UA_VariableAttributes *attr) {
21793  const UA_NodeId basevartype = UA_NODEID_NUMERIC(0, UA_NS0ID_BASEVARIABLETYPE);
21794  const UA_NodeId basedatavartype = UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE);
21795  const UA_NodeId *typeDef = &item->typeDefinition.nodeId;
21796  if(UA_NodeId_isNull(typeDef)) /* workaround when the variabletype is undefined */
21797  typeDef = &basedatavartype;
21798 
21799  /* Make sure we can instantiate the basetypes themselves */
21801  if(UA_NodeId_equal(&node->nodeId, &basevartype) ||
21802  UA_NodeId_equal(&node->nodeId, &basedatavartype)) {
21803  node->dataType = UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATATYPE);
21804  node->valueRank = -2;
21805  return retval;
21806  }
21807 
21808  const UA_VariableTypeNode *vt =
21809  (const UA_VariableTypeNode*)UA_NodeStore_get(server->nodestore, typeDef);
21810  if(!vt || vt->nodeClass != UA_NODECLASS_VARIABLETYPE)
21812  if(node->nodeClass == UA_NODECLASS_VARIABLE && vt->isAbstract)
21814 
21815  /* Set the datatype */
21816  if(!UA_NodeId_isNull(&attr->dataType))
21817  retval = writeDataTypeAttribute(server, node, &attr->dataType, &vt->dataType);
21818  else /* workaround common error where the datatype is left as NA_NODEID_NULL */
21819  retval = UA_NodeId_copy(&vt->dataType, &node->dataType);
21820  if(retval != UA_STATUSCODE_GOOD)
21821  return retval;
21822 
21823  /* Set the array dimensions. Check only against the vt. */
21824  retval = compatibleArrayDimensions(vt->arrayDimensionsSize, vt->arrayDimensions,
21825  attr->arrayDimensionsSize, attr->arrayDimensions);
21826  if(retval == UA_STATUSCODE_GOOD) {
21827  retval = UA_Array_copy(attr->arrayDimensions, attr->arrayDimensionsSize,
21828  (void**)&node->arrayDimensions, &UA_TYPES[UA_TYPES_UINT32]);
21829  }
21830  if(retval != UA_STATUSCODE_GOOD) {
21831  UA_LOG_INFO(server->config.logger, UA_LOGCATEGORY_SERVER,
21832  "Array dimensions incompatible with the VariableType "
21833  "with error code %s", UA_StatusCode_name(retval));
21834  return retval;
21835  }
21836  node->arrayDimensionsSize = attr->arrayDimensionsSize;
21837 
21838  /* Set the valuerank */
21839  if(attr->valueRank != 0 || !UA_Variant_isScalar(&attr->value))
21840  retval = writeValueRankAttribute(server, node, attr->valueRank, vt->valueRank);
21841  else /* workaround common error where the valuerank is left as 0 */
21842  node->valueRank = vt->valueRank;
21843  if(retval != UA_STATUSCODE_GOOD) {
21844  UA_LOG_INFO(server->config.logger, UA_LOGCATEGORY_SERVER,
21845  "Value Rank incompatible with the VariableType "
21846  "with error code %s", UA_StatusCode_name(retval));
21847  return retval;
21848  }
21849 
21850  /* Set the value */
21851  UA_DataValue value;
21852  UA_DataValue_init(&value);
21853  value.hasValue = true;
21854  value.value = attr->value;
21856 
21857  /* Use the default value from the vt if none is defined */
21858  if(!value.value.type) {
21859  retval = readValueAttribute(server, (const UA_VariableNode*)vt, &value);
21860  if(retval != UA_STATUSCODE_GOOD) {
21861  UA_LOG_INFO(server->config.logger, UA_LOGCATEGORY_SERVER,
21862  "Could not read the value of the variable type "
21863  "with error code %s", UA_StatusCode_name(retval));
21864  return retval;
21865  }
21866  }
21867 
21868  /* Write the value to the node */
21869  retval = writeValueAttribute(server, node, &value, NULL);
21870  if(retval != UA_STATUSCODE_GOOD) {
21871  UA_LOG_INFO(server->config.logger, UA_LOGCATEGORY_SERVER,
21872  "Could not set the value of the new node "
21873  "with error code %s", UA_StatusCode_name(retval));
21874  }
21875  UA_DataValue_deleteMembers(&value);
21876  return retval;
21877 }
21878 
21879 static UA_StatusCode
21880 copyVariableNodeAttributes(UA_Server *server, UA_VariableNode *vnode,
21881  const UA_AddNodesItem *item,
21882  const UA_VariableAttributes *attr) {
21883  vnode->accessLevel = attr->accessLevel;
21884  vnode->userAccessLevel = attr->userAccessLevel;
21885  vnode->historizing = attr->historizing;
21887  return copyCommonVariableAttributes(server, vnode, item, attr);
21888 }
21889 
21890 static UA_StatusCode
21891 copyVariableTypeNodeAttributes(UA_Server *server, UA_VariableTypeNode *vtnode,
21892  const UA_AddNodesItem *item,
21893  const UA_VariableTypeAttributes *attr) {
21894  vtnode->isAbstract = attr->isAbstract;
21895  return copyCommonVariableAttributes(server, (UA_VariableNode*)vtnode, item,
21896  (const UA_VariableAttributes*)attr);
21897 }
21898 
21899 static UA_StatusCode
21900 copyObjectNodeAttributes(UA_ObjectNode *onode, const UA_ObjectAttributes *attr) {
21901  onode->eventNotifier = attr->eventNotifier;
21902  return UA_STATUSCODE_GOOD;
21903 }
21904 
21905 static UA_StatusCode
21906 copyReferenceTypeNodeAttributes(UA_ReferenceTypeNode *rtnode,
21907  const UA_ReferenceTypeAttributes *attr) {
21908  rtnode->isAbstract = attr->isAbstract;
21909  rtnode->symmetric = attr->symmetric;
21910  return UA_LocalizedText_copy(&attr->inverseName, &rtnode->inverseName);
21911 }
21912 
21913 static UA_StatusCode
21914 copyObjectTypeNodeAttributes(UA_ObjectTypeNode *otnode,
21915  const UA_ObjectTypeAttributes *attr) {
21916  otnode->isAbstract = attr->isAbstract;
21917  return UA_STATUSCODE_GOOD;
21918 }
21919 
21920 static UA_StatusCode
21921 copyViewNodeAttributes(UA_ViewNode *vnode, const UA_ViewAttributes *attr) {
21922  vnode->containsNoLoops = attr->containsNoLoops;
21923  vnode->eventNotifier = attr->eventNotifier;
21924  return UA_STATUSCODE_GOOD;
21925 }
21926 
21927 static UA_StatusCode
21928 copyDataTypeNodeAttributes(UA_DataTypeNode *dtnode,
21929  const UA_DataTypeAttributes *attr) {
21930  dtnode->isAbstract = attr->isAbstract;
21931  return UA_STATUSCODE_GOOD;
21932 }
21933 
21934 #define CHECK_ATTRIBUTES(TYPE) \
21935  if(item->nodeAttributes.content.decoded.type != &UA_TYPES[UA_TYPES_##TYPE]) { \
21936  retval = UA_STATUSCODE_BADNODEATTRIBUTESINVALID; \
21937  break; \
21938  }
21939 
21940 static UA_StatusCode
21941 createNodeFromAttributes(UA_Server *server, const UA_AddNodesItem *item, UA_Node **newNode) {
21942  /* Check that we can read the attributes */
21944  !item->nodeAttributes.content.decoded.type)
21946 
21947  /* Create the node */
21948  // todo: error case where the nodeclass is faulty
21949  void *node = UA_NodeStore_newNode(item->nodeClass);
21950  if(!node)
21952 
21953  /* Copy the attributes into the node */
21954  void *data = item->nodeAttributes.content.decoded.data;
21955  UA_StatusCode retval = copyStandardAttributes(node, item, data);
21956  switch(item->nodeClass) {
21957  case UA_NODECLASS_OBJECT:
21958  CHECK_ATTRIBUTES(OBJECTATTRIBUTES);
21959  retval |= copyObjectNodeAttributes(node, data);
21960  break;
21961  case UA_NODECLASS_VARIABLE:
21962  CHECK_ATTRIBUTES(VARIABLEATTRIBUTES);
21963  retval |= copyVariableNodeAttributes(server, node, item, data);
21964  break;
21966  CHECK_ATTRIBUTES(OBJECTTYPEATTRIBUTES);
21967  retval |= copyObjectTypeNodeAttributes(node, data);
21968  break;
21970  CHECK_ATTRIBUTES(VARIABLETYPEATTRIBUTES);
21971  retval |= copyVariableTypeNodeAttributes(server, node, item, data);
21972  break;
21974  CHECK_ATTRIBUTES(REFERENCETYPEATTRIBUTES);
21975  retval |= copyReferenceTypeNodeAttributes(node, data);
21976  break;
21977  case UA_NODECLASS_DATATYPE:
21978  CHECK_ATTRIBUTES(DATATYPEATTRIBUTES);
21979  retval |= copyDataTypeNodeAttributes(node, data);
21980  break;
21981  case UA_NODECLASS_VIEW:
21982  CHECK_ATTRIBUTES(VIEWATTRIBUTES);
21983  retval |= copyViewNodeAttributes(node, data);
21984  break;
21985  case UA_NODECLASS_METHOD:
21987  default:
21989  }
21990 
21991  if(retval == UA_STATUSCODE_GOOD)
21992  *newNode = node;
21993  else
21995  return retval;
21996 }
21997 
21998 static void
21999 Service_AddNodes_single(UA_Server *server, UA_Session *session,
22000  const UA_AddNodesItem *item, UA_AddNodesResult *result,
22001  UA_InstantiationCallback *instantiationCallback) {
22002  /* Create the node from the attributes*/
22003  UA_Node *node = NULL;
22004  result->statusCode = createNodeFromAttributes(server, item, &node);
22005  if(result->statusCode != UA_STATUSCODE_GOOD) {
22006  UA_LOG_INFO_SESSION(server->config.logger, session,
22007  "Could not add node with error code %s",
22008  UA_StatusCode_name(result->statusCode));
22009  return;
22010  }
22011 
22012  /* Run consistency checks and add the node */
22013  UA_assert(node != NULL);
22014  result->statusCode = Service_AddNodes_existing(server, session, node, &item->parentNodeId.nodeId,
22015  &item->referenceTypeId, &item->typeDefinition.nodeId,
22016  instantiationCallback, &result->addedNodeId);
22017  if(result->statusCode != UA_STATUSCODE_GOOD) {
22018  UA_LOG_INFO_SESSION(server->config.logger, session,
22019  "Could not add node with error code %s",
22020  UA_StatusCode_name(result->statusCode));
22021  }
22022 }
22023 
22024 void Service_AddNodes(UA_Server *server, UA_Session *session,
22025  const UA_AddNodesRequest *request,
22026  UA_AddNodesResponse *response) {
22027  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing AddNodesRequest");
22028  if(request->nodesToAddSize <= 0) {
22030  return;
22031  }
22032  size_t size = request->nodesToAddSize;
22033 
22035  if(!response->results) {
22037  return;
22038  }
22039 
22040 
22041  response->resultsSize = size;
22042  for(size_t i = 0; i < size; ++i) {
22043  Service_AddNodes_single(server, session, &request->nodesToAdd[i],
22044  &response->results[i], NULL);
22045  }
22046 }
22047 
22049 __UA_Server_addNode(UA_Server *server, const UA_NodeClass nodeClass,
22050  const UA_NodeId requestedNewNodeId, const UA_NodeId parentNodeId,
22051  const UA_NodeId referenceTypeId, const UA_QualifiedName browseName,
22052  const UA_NodeId typeDefinition, const UA_NodeAttributes *attr,
22053  const UA_DataType *attributeType,
22054  UA_InstantiationCallback *instantiationCallback, UA_NodeId *outNewNodeId) {
22055  /* prepare the item */
22056  UA_AddNodesItem item;
22057  UA_AddNodesItem_init(&item);
22058  item.parentNodeId.nodeId = parentNodeId;
22059  item.referenceTypeId = referenceTypeId;
22060  item.requestedNewNodeId.nodeId = requestedNewNodeId;
22061  item.browseName = browseName;
22062  item.nodeClass = nodeClass;
22063  item.typeDefinition.nodeId = typeDefinition;
22066  .content.decoded = {attributeType, (void*)(uintptr_t)attr}};
22067 
22068  /* run the service */
22069  UA_AddNodesResult result;
22070  UA_AddNodesResult_init(&result);
22071  UA_RCU_LOCK();
22072  Service_AddNodes_single(server, &adminSession, &item, &result, instantiationCallback);
22073  UA_RCU_UNLOCK();
22074 
22075  /* prepare the output */
22076  if(outNewNodeId && result.statusCode == UA_STATUSCODE_GOOD)
22077  *outNewNodeId = result.addedNodeId;
22078  else
22079  UA_NodeId_deleteMembers(&result.addedNodeId);
22080  return result.statusCode;
22081 }
22082 
22083 /**************************************************/
22084 /* Add Special Nodes (not possible over the wire) */
22085 /**************************************************/
22086 
22088 UA_Server_addDataSourceVariableNode(UA_Server *server, const UA_NodeId requestedNewNodeId,
22089  const UA_NodeId parentNodeId, const UA_NodeId referenceTypeId,
22090  const UA_QualifiedName browseName, const UA_NodeId typeDefinition,
22091  const UA_VariableAttributes attr, const UA_DataSource dataSource,
22092  UA_NodeId *outNewNodeId) {
22093  /* Create the new node */
22094  UA_VariableNode *node = UA_NodeStore_newVariableNode();
22095  if(!node)
22097 
22098  /* Read the current value (to do typechecking) */
22100  UA_VariableAttributes editAttr = attr;
22101  UA_DataValue value;
22102  UA_DataValue_init(&value);
22103  if(dataSource.read)
22104  retval = dataSource.read(dataSource.handle, requestedNewNodeId,
22105  false, NULL, &value);
22106  else
22108  editAttr.value = value.value;
22109 
22110  if(retval != UA_STATUSCODE_GOOD) {
22111  UA_NodeStore_deleteNode((UA_Node*)node);
22112  return retval;
22113  }
22114 
22115  /* Copy attributes into node */
22116  UA_RCU_LOCK();
22117  UA_AddNodesItem item;
22118  UA_AddNodesItem_init(&item);
22119  item.requestedNewNodeId.nodeId = requestedNewNodeId;
22120  item.browseName = browseName;
22121  item.typeDefinition.nodeId = typeDefinition;
22122  item.parentNodeId.nodeId = parentNodeId;
22123  retval |= copyStandardAttributes((UA_Node*)node, &item, (const UA_NodeAttributes*)&editAttr);
22124  retval |= copyVariableNodeAttributes(server, node, &item, &editAttr);
22125  UA_DataValue_deleteMembers(&node->value.data.value);
22126  node->valueSource = UA_VALUESOURCE_DATASOURCE;
22127  node->value.dataSource = dataSource;
22128  UA_DataValue_deleteMembers(&value);
22129  if(retval != UA_STATUSCODE_GOOD) {
22130  UA_NodeStore_deleteNode((UA_Node*)node);
22131  UA_RCU_UNLOCK();
22132  return retval;
22133  }
22134 
22135  /* Add the node */
22136  UA_AddNodesResult result;
22137  UA_AddNodesResult_init(&result);
22138  retval = Service_AddNodes_existing(server, &adminSession, (UA_Node*)node, &parentNodeId,
22139  &referenceTypeId, &typeDefinition, NULL, outNewNodeId);
22140  UA_RCU_UNLOCK();
22141  return retval;
22142 }
22143 
22144 #ifdef UA_ENABLE_METHODCALLS
22145 
22147 UA_Server_addMethodNode(UA_Server *server, const UA_NodeId requestedNewNodeId,
22148  const UA_NodeId parentNodeId, const UA_NodeId referenceTypeId,
22149  const UA_QualifiedName browseName, const UA_MethodAttributes attr,
22150  UA_MethodCallback method, void *handle,
22151  size_t inputArgumentsSize, const UA_Argument* inputArguments,
22152  size_t outputArgumentsSize, const UA_Argument* outputArguments,
22153  UA_NodeId *outNewNodeId) {
22155  if(!node)
22157 
22158  UA_AddNodesItem item;
22159  UA_AddNodesItem_init(&item);
22160  item.requestedNewNodeId.nodeId = requestedNewNodeId;
22161  item.browseName = browseName;
22162  copyStandardAttributes((UA_Node*)node, &item, (const UA_NodeAttributes*)&attr);
22163  node->executable = attr.executable;
22164  node->userExecutable = attr.userExecutable;
22165  node->attachedMethod = method;
22166  node->methodHandle = handle;
22167 
22168  /* Add the node */
22169  UA_NodeId newMethodId;
22170  UA_NodeId_init(&newMethodId);
22171  UA_RCU_LOCK();
22172  UA_StatusCode retval = Service_AddNodes_existing(server, &adminSession, (UA_Node*)node, &parentNodeId,
22173  &referenceTypeId, &UA_NODEID_NULL, NULL, &newMethodId);
22174  UA_RCU_UNLOCK();
22175  if(retval != UA_STATUSCODE_GOOD)
22176  return retval;
22177 
22178  const UA_NodeId hasproperty = UA_NODEID_NUMERIC(0, UA_NS0ID_HASPROPERTY);
22179  const UA_NodeId propertytype = UA_NODEID_NUMERIC(0, UA_NS0ID_PROPERTYTYPE);
22180 
22181  if(inputArgumentsSize > 0) {
22182  UA_VariableNode *inputArgumentsVariableNode = UA_NodeStore_newVariableNode();
22183  inputArgumentsVariableNode->nodeId.namespaceIndex = newMethodId.namespaceIndex;
22184  inputArgumentsVariableNode->browseName = UA_QUALIFIEDNAME_ALLOC(0, "InputArguments");
22185  inputArgumentsVariableNode->displayName = UA_LOCALIZEDTEXT_ALLOC("en_US", "InputArguments");
22186  inputArgumentsVariableNode->description = UA_LOCALIZEDTEXT_ALLOC("en_US", "InputArguments");
22187  inputArgumentsVariableNode->valueRank = 1;
22188 
22189  /* UAExpert creates a monitoreditem on inputarguments ... */
22190  inputArgumentsVariableNode->minimumSamplingInterval = 10000.0f;
22191 
22192  //TODO: 0.3 work item: the addMethodNode API does not have the possibility to set nodeIDs
22193  //actually we need to change the signature to pass UA_NS0ID_SERVER_GETMONITOREDITEMS_INPUTARGUMENTS
22194  //and UA_NS0ID_SERVER_GETMONITOREDITEMS_OUTPUTARGUMENTS into the function :/
22195  if(newMethodId.namespaceIndex == 0 &&
22196  newMethodId.identifierType == UA_NODEIDTYPE_NUMERIC &&
22198  inputArgumentsVariableNode->nodeId =
22200  }
22201  UA_Variant_setArrayCopy(&inputArgumentsVariableNode->value.data.value.value,
22202  inputArguments, inputArgumentsSize,
22204  inputArgumentsVariableNode->value.data.value.hasValue = true;
22205  UA_RCU_LOCK();
22206  // todo: check if adding succeeded
22207  Service_AddNodes_existing(server, &adminSession, (UA_Node*)inputArgumentsVariableNode,
22208  &newMethodId, &hasproperty, &propertytype, NULL, NULL);
22209  UA_RCU_UNLOCK();
22210  }
22211 
22212  if(outputArgumentsSize > 0) {
22213  /* create OutputArguments */
22214  UA_VariableNode *outputArgumentsVariableNode = UA_NodeStore_newVariableNode();
22215  outputArgumentsVariableNode->nodeId.namespaceIndex = newMethodId.namespaceIndex;
22216  outputArgumentsVariableNode->browseName = UA_QUALIFIEDNAME_ALLOC(0, "OutputArguments");
22217  outputArgumentsVariableNode->displayName = UA_LOCALIZEDTEXT_ALLOC("en_US", "OutputArguments");
22218  outputArgumentsVariableNode->description = UA_LOCALIZEDTEXT_ALLOC("en_US", "OutputArguments");
22219  outputArgumentsVariableNode->valueRank = 1;
22220  //FIXME: comment in line 882
22221  if(newMethodId.namespaceIndex == 0 &&
22222  newMethodId.identifierType == UA_NODEIDTYPE_NUMERIC &&
22224  outputArgumentsVariableNode->nodeId =
22226  }
22227  UA_Variant_setArrayCopy(&outputArgumentsVariableNode->value.data.value.value,
22228  outputArguments, outputArgumentsSize,
22230  outputArgumentsVariableNode->value.data.value.hasValue = true;
22231  UA_RCU_LOCK();
22232  // todo: check if adding succeeded
22233  Service_AddNodes_existing(server, &adminSession, (UA_Node*)outputArgumentsVariableNode,
22234  &newMethodId, &hasproperty, &propertytype, NULL, NULL);
22235  UA_RCU_UNLOCK();
22236  }
22237 
22238  if(outNewNodeId)
22239  *outNewNodeId = newMethodId;
22240  else
22241  UA_NodeId_deleteMembers(&newMethodId);
22242  return retval;
22243 }
22244 
22245 #endif
22246 
22247 /******************/
22248 /* Add References */
22249 /******************/
22250 
22251 static UA_StatusCode
22252 deleteOneWayReference(UA_Server *server, UA_Session *session, UA_Node *node,
22253  const UA_DeleteReferencesItem *item);
22254 
22255 /* Adds a one-way reference to the local nodestore */
22256 static UA_StatusCode
22257 addOneWayReference(UA_Server *server, UA_Session *session,
22258  UA_Node *node, const UA_AddReferencesItem *item) {
22259  size_t i = node->referencesSize;
22260  size_t refssize = (i+1) | 3; // so the realloc is not necessary every time
22261  UA_ReferenceNode *new_refs = UA_realloc(node->references, sizeof(UA_ReferenceNode) * refssize);
22262  if(!new_refs)
22264  node->references = new_refs;
22265  UA_ReferenceNode_init(&new_refs[i]);
22266  UA_StatusCode retval = UA_NodeId_copy(&item->referenceTypeId, &new_refs[i].referenceTypeId);
22267  retval |= UA_ExpandedNodeId_copy(&item->targetNodeId, &new_refs[i].targetId);
22268  new_refs[i].isInverse = !item->isForward;
22269  if(retval == UA_STATUSCODE_GOOD)
22270  node->referencesSize = i+1;
22271  else
22272  UA_ReferenceNode_deleteMembers(&new_refs[i]);
22273  return retval;
22274 }
22275 
22276 static UA_StatusCode
22277 addReference(UA_Server *server, UA_Session *session,
22278  const UA_AddReferencesItem *item) {
22279  /* Currently no expandednodeids are allowed */
22280  if(item->targetServerUri.length > 0)
22282 
22283  /* Add the first direction */
22284  UA_StatusCode retval = UA_Server_editNode(server, session, &item->sourceNodeId,
22285  (UA_EditNodeCallback)addOneWayReference,
22286  item);
22287 
22288 
22289  if(retval != UA_STATUSCODE_GOOD)
22290  return retval;
22291 
22292  /* Add the second direction */
22293  UA_AddReferencesItem secondItem;
22294  UA_AddReferencesItem_init(&secondItem);
22295  secondItem.sourceNodeId = item->targetNodeId.nodeId;
22296  secondItem.referenceTypeId = item->referenceTypeId;
22297  secondItem.isForward = !item->isForward;
22298  secondItem.targetNodeId.nodeId = item->sourceNodeId;
22299  /* keep default secondItem.targetNodeClass = UA_NODECLASS_UNSPECIFIED */
22300 
22301  retval = UA_Server_editNode(server, session, &secondItem.sourceNodeId,
22302  (UA_EditNodeCallback)addOneWayReference, &secondItem);
22303 
22304  /* remove reference if the second direction failed */
22305  if(retval != UA_STATUSCODE_GOOD) {
22306  UA_DeleteReferencesItem deleteItem;
22307  deleteItem.sourceNodeId = item->sourceNodeId;
22308  deleteItem.referenceTypeId = item->referenceTypeId;
22309  deleteItem.isForward = item->isForward;
22310  deleteItem.targetNodeId = item->targetNodeId;
22311  deleteItem.deleteBidirectional = false;
22312  /* ignore returned status code */
22313  UA_Server_editNode(server, session, &item->sourceNodeId,
22314  (UA_EditNodeCallback)deleteOneWayReference, &deleteItem);
22315  }
22316  return retval;
22317 }
22318 
22319 void Service_AddReferences(UA_Server *server, UA_Session *session,
22320  const UA_AddReferencesRequest *request,
22321  UA_AddReferencesResponse *response) {
22322  UA_LOG_DEBUG_SESSION(server->config.logger, session,
22323  "Processing AddReferencesRequest");
22324  if(request->referencesToAddSize <= 0) {
22326  return;
22327  }
22328 
22329  response->results = UA_malloc(sizeof(UA_StatusCode) * request->referencesToAddSize);
22330  if(!response->results) {
22332  return;
22333  }
22334  response->resultsSize = request->referencesToAddSize;
22335 
22336  for(size_t i = 0; i < response->resultsSize; ++i)
22337  response->results[i] =
22338  addReference(server, session, &request->referencesToAdd[i]);
22339 }
22340 
22342 UA_Server_addReference(UA_Server *server, const UA_NodeId sourceId,
22343  const UA_NodeId refTypeId, const UA_ExpandedNodeId targetId,
22344  UA_Boolean isForward) {
22345  UA_AddReferencesItem item;
22346  UA_AddReferencesItem_init(&item);
22347  item.sourceNodeId = sourceId;
22348  item.referenceTypeId = refTypeId;
22349  item.isForward = isForward;
22350  item.targetNodeId = targetId;
22351  UA_RCU_LOCK();
22352  UA_StatusCode retval = addReference(server, &adminSession, &item);
22353  UA_RCU_UNLOCK();
22354  return retval;
22355 }
22356 
22357 /****************/
22358 /* Delete Nodes */
22359 /****************/
22360 
22361 static void
22362 removeReferences(UA_Server *server, UA_Session *session, const UA_Node *node) {
22364  UA_DeleteReferencesItem_init(&item);
22365  item.targetNodeId.nodeId = node->nodeId;
22366  for(size_t i = 0; i < node->referencesSize; ++i) {
22367  item.isForward = node->references[i].isInverse;
22368  item.sourceNodeId = node->references[i].targetId.nodeId;
22369  item.referenceTypeId = node->references[i].referenceTypeId;
22370  deleteReference(server, session, &item);
22371  }
22372 }
22373 
22374 static UA_StatusCode
22375 deleteNode(UA_Server *server, UA_Session *session,
22376  const UA_NodeId *nodeId, UA_Boolean deleteReferences) {
22377  const UA_Node *node = UA_NodeStore_get(server->nodestore, nodeId);
22378  if(!node)
22380 
22381  /* TODO: check if the information model consistency is violated */
22382  /* TODO: Check if the node is a mandatory child of an object */
22383 
22384  /* Destroy an object before removing it */
22385  if(node->nodeClass == UA_NODECLASS_OBJECT) {
22386  /* Call the destructor from the object type */
22387  const UA_ObjectTypeNode *typenode = getObjectNodeType(server, (const UA_ObjectNode*)node);
22388  if(typenode && typenode->lifecycleManagement.destructor)
22389  typenode->lifecycleManagement.destructor(*nodeId, ((const UA_ObjectNode*)node)->instanceHandle);
22390  }
22391 
22392  /* Remove references to the node (not the references in the node that will
22393  * be deleted anyway) */
22394  if(deleteReferences)
22395  removeReferences(server, session, node);
22396 
22397  return UA_NodeStore_remove(server->nodestore, nodeId);
22398 }
22399 
22400 void Service_DeleteNodes(UA_Server *server, UA_Session *session,
22401  const UA_DeleteNodesRequest *request,
22402  UA_DeleteNodesResponse *response) {
22403  UA_LOG_DEBUG_SESSION(server->config.logger, session,
22404  "Processing DeleteNodesRequest");
22405  if(request->nodesToDeleteSize == 0) {
22407  return;
22408  }
22409 
22410  response->results = UA_malloc(sizeof(UA_StatusCode) * request->nodesToDeleteSize);
22411  if(!response->results) {
22413  return;
22414  }
22415  response->resultsSize = request->nodesToDeleteSize;
22416 
22417  for(size_t i = 0; i < request->nodesToDeleteSize; ++i) {
22418  UA_DeleteNodesItem *item = &request->nodesToDelete[i];
22419  response->results[i] = deleteNode(server, session, &item->nodeId,
22420  item->deleteTargetReferences);
22421  }
22422 }
22423 
22425 UA_Server_deleteNode(UA_Server *server, const UA_NodeId nodeId,
22426  UA_Boolean deleteReferences) {
22427  UA_RCU_LOCK();
22428  UA_StatusCode retval = deleteNode(server, &adminSession,
22429  &nodeId, deleteReferences);
22430  UA_RCU_UNLOCK();
22431  return retval;
22432 }
22433 
22434 /*********************/
22435 /* Delete References */
22436 /*********************/
22437 
22438 // TODO: Check consistency constraints, remove the references.
22439 static UA_StatusCode
22440 deleteOneWayReference(UA_Server *server, UA_Session *session, UA_Node *node,
22441  const UA_DeleteReferencesItem *item) {
22442  UA_Boolean edited = false;
22443  for(size_t i = node->referencesSize; i > 0; --i) {
22444  UA_ReferenceNode *ref = &node->references[i-1];
22445  if(!UA_NodeId_equal(&item->targetNodeId.nodeId, &ref->targetId.nodeId))
22446  continue;
22447  if(!UA_NodeId_equal(&item->referenceTypeId, &ref->referenceTypeId))
22448  continue;
22449  if(item->isForward == ref->isInverse)
22450  continue;
22451  UA_ReferenceNode_deleteMembers(ref);
22452  /* move the last entry to override the current position */
22453  node->references[i-1] = node->references[node->referencesSize-1];
22454  --node->referencesSize;
22455  edited = true;
22456  break;
22457  }
22458  if(!edited)
22460  /* we removed the last reference */
22461  if(node->referencesSize == 0 && node->references) {
22462  UA_free(node->references);
22463  node->references = NULL;
22464  }
22465  return UA_STATUSCODE_GOOD;;
22466 }
22467 
22468 static UA_StatusCode
22469 deleteReference(UA_Server *server, UA_Session *session,
22470  const UA_DeleteReferencesItem *item) {
22471  UA_StatusCode retval = UA_Server_editNode(server, session, &item->sourceNodeId,
22472  (UA_EditNodeCallback)deleteOneWayReference, item);
22473  if(retval != UA_STATUSCODE_GOOD)
22474  return retval;
22475  if(!item->deleteBidirectional || item->targetNodeId.serverIndex != 0)
22476  return retval;
22477  UA_DeleteReferencesItem secondItem;
22478  UA_DeleteReferencesItem_init(&secondItem);
22479  secondItem.isForward = !item->isForward;
22480  secondItem.sourceNodeId = item->targetNodeId.nodeId;
22481  secondItem.targetNodeId.nodeId = item->sourceNodeId;
22482  secondItem.referenceTypeId = item->referenceTypeId;
22483  return UA_Server_editNode(server, session, &secondItem.sourceNodeId,
22484  (UA_EditNodeCallback)deleteOneWayReference, &secondItem);
22485 }
22486 
22487 void
22488 Service_DeleteReferences(UA_Server *server, UA_Session *session,
22489  const UA_DeleteReferencesRequest *request,
22490  UA_DeleteReferencesResponse *response) {
22491  UA_LOG_DEBUG_SESSION(server->config.logger, session,
22492  "Processing DeleteReferencesRequest");
22493  if(request->referencesToDeleteSize <= 0) {
22495  return;
22496  }
22497 
22498  response->results = UA_malloc(sizeof(UA_StatusCode) * request->referencesToDeleteSize);
22499  if(!response->results) {
22501  return;
22502  }
22503  response->resultsSize = request->referencesToDeleteSize;
22504 
22505  for(size_t i = 0; i < request->referencesToDeleteSize; ++i)
22506  response->results[i] =
22507  deleteReference(server, session, &request->referencesToDelete[i]);
22508 }
22509 
22511 UA_Server_deleteReference(UA_Server *server, const UA_NodeId sourceNodeId,
22512  const UA_NodeId referenceTypeId,
22513  UA_Boolean isForward, const UA_ExpandedNodeId targetNodeId,
22514  UA_Boolean deleteBidirectional) {
22516  item.sourceNodeId = sourceNodeId;
22517  item.referenceTypeId = referenceTypeId;
22518  item.isForward = isForward;
22519  item.targetNodeId = targetNodeId;
22520  item.deleteBidirectional = deleteBidirectional;
22521  UA_RCU_LOCK();
22522  UA_StatusCode retval = deleteReference(server, &adminSession, &item);
22523  UA_RCU_UNLOCK();
22524  return retval;
22525 }
22526 
22527 /**********************/
22528 /* Set Value Callback */
22529 /**********************/
22530 
22531 static UA_StatusCode
22532 setValueCallback(UA_Server *server, UA_Session *session,
22533  UA_VariableNode *node, UA_ValueCallback *callback) {
22534  if(node->nodeClass != UA_NODECLASS_VARIABLE)
22536  node->value.data.callback = *callback;
22537  return UA_STATUSCODE_GOOD;
22538 }
22539 
22541 UA_Server_setVariableNode_valueCallback(UA_Server *server, const UA_NodeId nodeId,
22542  const UA_ValueCallback callback) {
22543  UA_RCU_LOCK();
22544  UA_StatusCode retval = UA_Server_editNode(server, &adminSession, &nodeId,
22545  (UA_EditNodeCallback)setValueCallback, &callback);
22546  UA_RCU_UNLOCK();
22547  return retval;
22548 }
22549 
22550 /******************/
22551 /* Set DataSource */
22552 /******************/
22553 
22554 static UA_StatusCode
22555 setDataSource(UA_Server *server, UA_Session *session,
22556  UA_VariableNode* node, UA_DataSource *dataSource) {
22557  if(node->nodeClass != UA_NODECLASS_VARIABLE)
22559  if(node->valueSource == UA_VALUESOURCE_DATA)
22560  UA_DataValue_deleteMembers(&node->value.data.value);
22561  node->value.dataSource = *dataSource;
22562  node->valueSource = UA_VALUESOURCE_DATASOURCE;
22563  return UA_STATUSCODE_GOOD;
22564 }
22565 
22567 UA_Server_setVariableNode_dataSource(UA_Server *server, const UA_NodeId nodeId,
22568  const UA_DataSource dataSource) {
22569  UA_RCU_LOCK();
22570  UA_StatusCode retval = UA_Server_editNode(server, &adminSession, &nodeId,
22571  (UA_EditNodeCallback)setDataSource, &dataSource);
22572  UA_RCU_UNLOCK();
22573  return retval;
22574 }
22575 
22576 /****************************/
22577 /* Set Lifecycle Management */
22578 /****************************/
22579 
22580 static UA_StatusCode
22581 setOLM(UA_Server *server, UA_Session *session,
22582  UA_ObjectTypeNode* node, UA_ObjectLifecycleManagement *olm) {
22583  if(node->nodeClass != UA_NODECLASS_OBJECTTYPE)
22585  node->lifecycleManagement = *olm;
22586  return UA_STATUSCODE_GOOD;
22587 }
22588 
22591  UA_ObjectLifecycleManagement olm) {
22592  UA_RCU_LOCK();
22593  UA_StatusCode retval = UA_Server_editNode(server, &adminSession, &nodeId,
22594  (UA_EditNodeCallback)setOLM, &olm);
22595  UA_RCU_UNLOCK();
22596  return retval;
22597 }
22598 
22599 /***********************/
22600 /* Set Method Callback */
22601 /***********************/
22602 
22603 #ifdef UA_ENABLE_METHODCALLS
22604 
22605 struct addMethodCallback {
22606  UA_MethodCallback callback;
22607  void *handle;
22608 };
22609 
22610 static UA_StatusCode
22611 editMethodCallback(UA_Server *server, UA_Session* session,
22612  UA_Node* node, const void* handle) {
22613  if(node->nodeClass != UA_NODECLASS_METHOD)
22615  const struct addMethodCallback *newCallback = handle;
22616  UA_MethodNode *mnode = (UA_MethodNode*) node;
22617  mnode->attachedMethod = newCallback->callback;
22618  mnode->methodHandle = newCallback->handle;
22619  return UA_STATUSCODE_GOOD;
22620 }
22621 
22623 UA_Server_setMethodNode_callback(UA_Server *server, const UA_NodeId methodNodeId,
22624  UA_MethodCallback method, void *handle) {
22625  struct addMethodCallback cb = { method, handle };
22626  UA_RCU_LOCK();
22627  UA_StatusCode retval = UA_Server_editNode(server, &adminSession,
22628  &methodNodeId, editMethodCallback, &cb);
22629  UA_RCU_UNLOCK();
22630  return retval;
22631 }
22632 
22633 #endif
22634 
22635 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_services_view.c" ***********************************/
22636 
22637 /* This Source Code Form is subject to the terms of the Mozilla Public
22638 * License, v. 2.0. If a copy of the MPL was not distributed with this
22639 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
22640 
22641 
22642 static UA_StatusCode
22643 fillReferenceDescription(UA_NodeStore *ns, const UA_Node *curr, UA_ReferenceNode *ref,
22644  UA_UInt32 mask, UA_ReferenceDescription *descr) {
22645  UA_ReferenceDescription_init(descr);
22646  UA_StatusCode retval = UA_NodeId_copy(&curr->nodeId, &descr->nodeId.nodeId);
22648  retval |= UA_NodeId_copy(&ref->referenceTypeId, &descr->referenceTypeId);
22650  descr->isForward = !ref->isInverse;
22652  retval |= UA_NodeClass_copy(&curr->nodeClass, &descr->nodeClass);
22654  retval |= UA_QualifiedName_copy(&curr->browseName, &descr->browseName);
22656  retval |= UA_LocalizedText_copy(&curr->displayName, &descr->displayName);
22658  if(curr->nodeClass == UA_NODECLASS_OBJECT || curr->nodeClass == UA_NODECLASS_VARIABLE) {
22659  for(size_t i = 0; i < curr->referencesSize; ++i) {
22660  UA_ReferenceNode *refnode = &curr->references[i];
22662  retval |= UA_ExpandedNodeId_copy(&refnode->targetId, &descr->typeDefinition);
22663  break;
22664  }
22665  }
22666  }
22667  }
22668  return retval;
22669 }
22670 
22671 
22672 /* Tests if the node is relevant to the browse request and shall be returned. If
22673  so, it is retrieved from the Nodestore. If not, null is returned. */
22674 static const UA_Node *
22675 returnRelevantNode(UA_Server *server, const UA_BrowseDescription *descr, UA_Boolean return_all,
22676  const UA_ReferenceNode *reference, const UA_NodeId *relevant, size_t relevant_count,
22677  UA_Boolean *isExternal) {
22678  /* reference in the right direction? */
22679  if(reference->isInverse && descr->browseDirection == UA_BROWSEDIRECTION_FORWARD)
22680  return NULL;
22681  if(!reference->isInverse && descr->browseDirection == UA_BROWSEDIRECTION_INVERSE)
22682  return NULL;
22683 
22684  /* is the reference part of the hierarchy of references we look for? */
22685  if(!return_all) {
22686  UA_Boolean is_relevant = false;
22687  for(size_t i = 0; i < relevant_count; ++i) {
22688  if(UA_NodeId_equal(&reference->referenceTypeId, &relevant[i])) {
22689  is_relevant = true;
22690  break;
22691  }
22692  }
22693  if(!is_relevant)
22694  return NULL;
22695  }
22696 
22697 
22698  /* return from the internal nodestore */
22699  const UA_Node *node = UA_NodeStore_get(server->nodestore, &reference->targetId.nodeId);
22700  if(node && descr->nodeClassMask != 0 && (node->nodeClass & descr->nodeClassMask) == 0)
22701  return NULL;
22702  *isExternal = false;
22703  return node;
22704 }
22705 
22706 static void removeCp(struct ContinuationPointEntry *cp, UA_Session* session) {
22707  LIST_REMOVE(cp, pointers);
22708  UA_ByteString_deleteMembers(&cp->identifier);
22709  UA_BrowseDescription_deleteMembers(&cp->browseDescription);
22710  UA_free(cp);
22711  ++session->availableContinuationPoints;
22712 }
22713 
22714 /* Results for a single browsedescription. This is the inner loop for both
22715  * Browse and BrowseNext
22716  *
22717  * @param session Session to save continuationpoints
22718  * @param ns The nodstore where the to-be-browsed node can be found
22719  * @param cp If cp is not null, we continue from here If cp is null, we can add
22720  * a new continuation point if possible and necessary.
22721  * @param descr If no cp is set, we take the browsedescription from there
22722  * @param maxrefs The maximum number of references the client has requested. If 0,
22723  * all matching references are returned at once.
22724  * @param result The entry in the request */
22725 void
22726 Service_Browse_single(UA_Server *server, UA_Session *session,
22727  struct ContinuationPointEntry *cp, const UA_BrowseDescription *descr,
22728  UA_UInt32 maxrefs, UA_BrowseResult *result) {
22729  size_t referencesCount = 0;
22730  size_t referencesIndex = 0;
22731  /* set the browsedescription if a cp is given */
22732  UA_UInt32 continuationIndex = 0;
22733  struct ContinuationPointEntry *cpLoop = NULL, *cpLast = NULL;
22734  if(cp) {
22735  descr = &cp->browseDescription;
22736  maxrefs = cp->maxReferences;
22737  continuationIndex = cp->continuationIndex;
22738  }
22739 
22740  /* is the browsedirection valid? */
22745  return;
22746  }
22747 
22748  /* get the references that match the browsedescription */
22749  size_t relevant_refs_size = 0;
22750  UA_NodeId *relevant_refs = NULL;
22751  UA_Boolean all_refs = UA_NodeId_isNull(&descr->referenceTypeId);
22752  if(!all_refs) {
22753  const UA_Node *rootRef = UA_NodeStore_get(server->nodestore, &descr->referenceTypeId);
22754  if(!rootRef || rootRef->nodeClass != UA_NODECLASS_REFERENCETYPE) {
22756  return;
22757  }
22758  if(descr->includeSubtypes) {
22759  result->statusCode = getTypeHierarchy(server->nodestore, rootRef, false,
22760  &relevant_refs, &relevant_refs_size);
22761  if(result->statusCode != UA_STATUSCODE_GOOD)
22762  return;
22763  } else {
22764  relevant_refs = (UA_NodeId*)(uintptr_t)&descr->referenceTypeId;
22765  relevant_refs_size = 1;
22766  }
22767  }
22768 
22769  /* get the node */
22770  const UA_Node *node = UA_NodeStore_get(server->nodestore, &descr->nodeId);
22771  if(!node) {
22773  if(!all_refs && descr->includeSubtypes)
22774  UA_Array_delete(relevant_refs, relevant_refs_size, &UA_TYPES[UA_TYPES_NODEID]);
22775  return;
22776  }
22777 
22778  /* if the node has no references, just return */
22779  if(node->referencesSize == 0) {
22780  result->referencesSize = 0;
22781  if(!all_refs && descr->includeSubtypes)
22782  UA_Array_delete(relevant_refs, relevant_refs_size, &UA_TYPES[UA_TYPES_NODEID]);
22783  return;
22784  }
22785 
22786  /* how many references can we return at most? */
22787  size_t real_maxrefs = maxrefs;
22788  if(real_maxrefs == 0)
22789  real_maxrefs = node->referencesSize;
22790  else if(real_maxrefs > node->referencesSize)
22791  real_maxrefs = node->referencesSize;
22793  if(!result->references) {
22795  goto cleanup;
22796  }
22797 
22798  /* loop over the node's references */
22799  size_t skipped = 0;
22800  UA_Boolean isExternal = false;
22802  for(; referencesIndex < node->referencesSize && referencesCount < real_maxrefs; ++referencesIndex) {
22803  isExternal = false;
22804  const UA_Node *current =
22805  returnRelevantNode(server, descr, all_refs, &node->references[referencesIndex],
22806  relevant_refs, relevant_refs_size, &isExternal);
22807  if(!current)
22808  continue;
22809 
22810  if(skipped < continuationIndex) {
22811  ++skipped;
22812  } else {
22813  retval |= fillReferenceDescription(server->nodestore, current,
22814  &node->references[referencesIndex],
22815  descr->resultMask,
22816  &result->references[referencesCount]);
22817  ++referencesCount;
22818  }
22819  }
22820  result->referencesSize = referencesCount;
22821 
22822  if(referencesCount == 0) {
22823  UA_free(result->references);
22824  result->references = NULL;
22825  result->referencesSize = 0;
22826  }
22827 
22828  if(retval != UA_STATUSCODE_GOOD) {
22829  UA_Array_delete(result->references, result->referencesSize,
22830  &UA_TYPES[UA_TYPES_REFERENCEDESCRIPTION]);
22831  result->references = NULL;
22832  result->referencesSize = 0;
22833  result->statusCode = retval;
22834  }
22835 
22836  cleanup:
22837  if(!all_refs && descr->includeSubtypes)
22838  UA_Array_delete(relevant_refs, relevant_refs_size, &UA_TYPES[UA_TYPES_NODEID]);
22839  if(result->statusCode != UA_STATUSCODE_GOOD)
22840  return;
22841 
22842  /* create, update, delete continuation points */
22843  if(cp) {
22844  if(referencesIndex == node->referencesSize) {
22845  /* all done, remove a finished continuationPoint */
22846  removeCp(cp, session);
22847  } else {
22848  /* update the cp and return the cp identifier */
22849  cp->continuationIndex += (UA_UInt32)referencesCount;
22850  UA_ByteString_copy(&cp->identifier, &result->continuationPoint);
22851  }
22852  } else if(maxrefs != 0 && referencesCount >= maxrefs) {
22853  if (session->availableContinuationPoints <= 0) {
22854  // if no more ContinuationPoints are available,
22855  // we delete the last one
22856  LIST_FOREACH(cpLoop, &session->continuationPoints, pointers) {
22857  cpLast = cpLoop;
22858  }
22859 
22860  if (cpLast) {
22861  removeCp(cpLast, session);
22862  }
22863  }
22864 
22865  /* create a cp */
22866  if (session->availableContinuationPoints <= 0 ||
22867  !(cp = UA_malloc(sizeof(struct ContinuationPointEntry)))) {
22869  return;
22870  }
22871  UA_BrowseDescription_copy(descr, &cp->browseDescription);
22872  cp->maxReferences = maxrefs;
22873  cp->continuationIndex = (UA_UInt32) referencesCount;
22874  UA_Guid *ident = UA_Guid_new();
22875  *ident = UA_Guid_random();
22876  cp->identifier.data = (UA_Byte*) ident;
22877  cp->identifier.length = sizeof(UA_Guid);
22878  UA_ByteString_copy(&cp->identifier, &result->continuationPoint);
22879 
22880  /* store the cp */
22881  LIST_INSERT_HEAD(&session->continuationPoints, cp, pointers);
22882  --session->availableContinuationPoints;
22883  }
22884 }
22885 
22886 void Service_Browse(UA_Server *server, UA_Session *session, const UA_BrowseRequest *request,
22887  UA_BrowseResponse *response) {
22888  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing BrowseRequest");
22889  if(!UA_NodeId_isNull(&request->view.viewId)) {
22891  return;
22892  }
22893 
22894  if(request->nodesToBrowseSize <= 0) {
22896  return;
22897  }
22898 
22899  size_t size = request->nodesToBrowseSize;
22900  response->results = UA_Array_new(size, &UA_TYPES[UA_TYPES_BROWSERESULT]);
22901  if(!response->results) {
22903  return;
22904  }
22905  response->resultsSize = size;
22906 
22907 
22908  for(size_t i = 0; i < size; ++i) {
22909  Service_Browse_single(server, session, NULL, &request->nodesToBrowse[i],
22910  request->requestedMaxReferencesPerNode, &response->results[i]);
22911  }
22912 }
22913 
22915 UA_Server_browse(UA_Server *server, UA_UInt32 maxrefs, const UA_BrowseDescription *descr) {
22916  UA_BrowseResult result;
22917  UA_BrowseResult_init(&result);
22918  UA_RCU_LOCK();
22919  Service_Browse_single(server, &adminSession, NULL, descr, maxrefs, &result);
22920  UA_RCU_UNLOCK();
22921  return result;
22922 }
22923 
22924 static void
22925 UA_Server_browseNext_single(UA_Server *server, UA_Session *session, UA_Boolean releaseContinuationPoint,
22926  const UA_ByteString *continuationPoint, UA_BrowseResult *result) {
22928  struct ContinuationPointEntry *cp, *temp;
22929  LIST_FOREACH_SAFE(cp, &session->continuationPoints, pointers, temp) {
22930  if(UA_ByteString_equal(&cp->identifier, continuationPoint)) {
22931  result->statusCode = UA_STATUSCODE_GOOD;
22932  if(!releaseContinuationPoint)
22933  Service_Browse_single(server, session, cp, NULL, 0, result);
22934  else
22935  removeCp(cp, session);
22936  break;
22937  }
22938  }
22939 }
22940 
22941 void Service_BrowseNext(UA_Server *server, UA_Session *session, const UA_BrowseNextRequest *request,
22942  UA_BrowseNextResponse *response) {
22943  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing BrowseNextRequest");
22944  if(request->continuationPointsSize <= 0) {
22946  return;
22947  }
22948  size_t size = request->continuationPointsSize;
22949  response->results = UA_Array_new(size, &UA_TYPES[UA_TYPES_BROWSERESULT]);
22950  if(!response->results) {
22952  return;
22953  }
22954 
22955  response->resultsSize = size;
22956  for(size_t i = 0; i < size; ++i)
22957  UA_Server_browseNext_single(server, session, request->releaseContinuationPoints,
22958  &request->continuationPoints[i], &response->results[i]);
22959 }
22960 
22962 UA_Server_browseNext(UA_Server *server, UA_Boolean releaseContinuationPoint,
22963  const UA_ByteString *continuationPoint) {
22964  UA_BrowseResult result;
22965  UA_BrowseResult_init(&result);
22966  UA_RCU_LOCK();
22967  UA_Server_browseNext_single(server, &adminSession, releaseContinuationPoint,
22968  continuationPoint, &result);
22969  UA_RCU_UNLOCK();
22970  return result;
22971 }
22972 
22973 /***********************/
22974 /* TranslateBrowsePath */
22975 /***********************/
22976 
22977 static void
22978 walkBrowsePathElementNodeReference(UA_BrowsePathResult *result, size_t *targetsSize,
22979  UA_NodeId **next, size_t *nextSize, size_t *nextCount,
22980  UA_UInt32 elemDepth, UA_Boolean inverse, UA_Boolean all_refs,
22981  const UA_NodeId *reftypes, size_t reftypes_count,
22982  const UA_ReferenceNode *reference) {
22983  /* Does the direction of the reference match? */
22984  if(reference->isInverse != inverse)
22985  return;
22986 
22987  /* Is the node relevant? */
22988  if(!all_refs) {
22989  UA_Boolean match = false;
22990  for(size_t j = 0; j < reftypes_count; ++j) {
22991  if(UA_NodeId_equal(&reference->referenceTypeId, &reftypes[j])) {
22992  match = true;
22993  break;
22994  }
22995  }
22996  if(!match)
22997  return;
22998  }
22999 
23000  /* Does the reference point to an external server? Then add to the
23001  * targets with the right path "depth" */
23002  if(reference->targetId.serverIndex != 0) {
23003  UA_BrowsePathTarget *tempTargets =
23004  UA_realloc(result->targets, sizeof(UA_BrowsePathTarget) * (*targetsSize) * 2);
23005  if(!tempTargets) {
23007  return;
23008  }
23009  result->targets = tempTargets;
23010  (*targetsSize) *= 2;
23011  result->statusCode = UA_ExpandedNodeId_copy(&reference->targetId,
23012  &result->targets[result->targetsSize].targetId);
23013  result->targets[result->targetsSize].remainingPathIndex = elemDepth;
23014  return;
23015  }
23016 
23017  /* Add the node to the next array for the following path element */
23018  if(*nextSize <= *nextCount) {
23019  UA_NodeId *tempNext = UA_realloc(*next, sizeof(UA_NodeId) * (*nextSize) * 2);
23020  if(!tempNext) {
23022  return;
23023  }
23024  *next = tempNext;
23025  (*nextSize) *= 2;
23026  }
23027  result->statusCode = UA_NodeId_copy(&reference->targetId.nodeId,
23028  &(*next)[*nextCount]);
23029  ++(*nextCount);
23030 }
23031 
23032 static void
23033 walkBrowsePathElement(UA_Server *server, UA_Session *session,
23034  UA_BrowsePathResult *result, size_t *targetsSize,
23035  const UA_RelativePathElement *elem, UA_UInt32 elemDepth,
23036  const UA_QualifiedName *targetName,
23037  const UA_NodeId *current, const size_t currentCount,
23038  UA_NodeId **next, size_t *nextSize, size_t *nextCount) {
23039  /* Get the full list of relevant referencetypes for this path element */
23040  UA_NodeId *reftypes = NULL;
23041  size_t reftypes_count = 1; // all_refs or no subtypes => 1
23042  UA_Boolean all_refs = false;
23043  if(UA_NodeId_isNull(&elem->referenceTypeId)) {
23044  all_refs = true;
23045  } else if(!elem->includeSubtypes) {
23046  reftypes = (UA_NodeId*)(uintptr_t)&elem->referenceTypeId; // ptr magic due to const cast
23047  } else {
23048  const UA_Node *rootRef = UA_NodeStore_get(server->nodestore, &elem->referenceTypeId);
23049  if(!rootRef || rootRef->nodeClass != UA_NODECLASS_REFERENCETYPE)
23050  return;
23051  UA_StatusCode retval =
23052  getTypeHierarchy(server->nodestore, rootRef, false, &reftypes, &reftypes_count);
23053  if(retval != UA_STATUSCODE_GOOD)
23054  return;
23055  }
23056 
23057  /* Iterate over all nodes at the current depth-level */
23058  for(size_t i = 0; i < currentCount; ++i) {
23059  /* Get the node */
23060  const UA_Node *node = UA_NodeStore_get(server->nodestore, &current[i]);
23061  if(!node) {
23062  /* If we cannot find the node at depth 0, the starting node does not exist */
23063  if(elemDepth == 0)
23065  continue;
23066  }
23067 
23068  /* Test whether the current node has the target name required in the
23069  * previous path element */
23070  if(targetName && (targetName->namespaceIndex != node->browseName.namespaceIndex ||
23071  !UA_String_equal(&targetName->name, &node->browseName.name)))
23072  continue;
23073 
23074  /* Walk over the references in the node */
23075  /* Loop over the nodes references */
23076  for(size_t r = 0; r < node->referencesSize &&
23077  result->statusCode == UA_STATUSCODE_GOOD; ++r) {
23078  UA_ReferenceNode *reference = &node->references[r];
23079  walkBrowsePathElementNodeReference(result, targetsSize, next, nextSize, nextCount,
23080  elemDepth, elem->isInverse, all_refs,
23081  reftypes, reftypes_count, reference);
23082  }
23083  }
23084 
23085  if(!all_refs && elem->includeSubtypes)
23086  UA_Array_delete(reftypes, reftypes_count, &UA_TYPES[UA_TYPES_NODEID]);
23087 }
23088 
23089 /* This assumes that result->targets has enough room for all currentCount elements */
23090 static void
23091 addBrowsePathTargets(UA_Server *server, UA_Session *session, UA_BrowsePathResult *result,
23092  const UA_QualifiedName *targetName, UA_NodeId *current, size_t currentCount) {
23093  for(size_t i = 0; i < currentCount; i++) {
23094  /* Get the node */
23095  const UA_Node *node = UA_NodeStore_get(server->nodestore, &current[i]);
23096  if(!node) {
23097  UA_NodeId_deleteMembers(&current[i]);
23098  continue;
23099  }
23100 
23101  /* Test whether the current node has the target name required in the
23102  * previous path element */
23103  if(targetName->namespaceIndex != node->browseName.namespaceIndex ||
23104  !UA_String_equal(&targetName->name, &node->browseName.name)) {
23105  UA_NodeId_deleteMembers(&current[i]);
23106  continue;
23107  }
23108 
23109  /* Move the nodeid to the target array */
23110  UA_BrowsePathTarget_init(&result->targets[result->targetsSize]);
23111  result->targets[result->targetsSize].targetId.nodeId = current[i];
23113  ++result->targetsSize;
23114  }
23115 }
23116 
23117 static void
23118 walkBrowsePath(UA_Server *server, UA_Session *session, const UA_BrowsePath *path,
23119  UA_BrowsePathResult *result, size_t targetsSize,
23120  UA_NodeId **current, size_t *currentSize, size_t *currentCount,
23121  UA_NodeId **next, size_t *nextSize, size_t *nextCount) {
23122  UA_assert(*currentCount == 1);
23123  UA_assert(*nextCount == 0);
23124 
23125  /* Points to the targetName of the _previous_ path element */
23126  const UA_QualifiedName *targetName = NULL;
23127 
23128  /* Iterate over path elements */
23129  UA_assert(path->relativePath.elementsSize > 0);
23130  for(UA_UInt32 i = 0; i < path->relativePath.elementsSize; ++i) {
23131  walkBrowsePathElement(server, session, result, &targetsSize,
23132  &path->relativePath.elements[i], i, targetName,
23133  *current, *currentCount, next, nextSize, nextCount);
23134 
23135  /* Clean members of current */
23136  for(size_t j = 0; j < *currentCount; j++)
23137  UA_NodeId_deleteMembers(&(*current)[j]);
23138  *currentCount = 0;
23139 
23140  /* When no targets are left or an error occurred. None of next's
23141  * elements will be copied to result->targets */
23142  if(*nextCount == 0 || result->statusCode != UA_STATUSCODE_GOOD) {
23143  UA_assert(*currentCount == 0);
23144  UA_assert(*nextCount == 0);
23145  return;
23146  }
23147 
23148  /* Exchange current and next for the next depth */
23149  size_t tSize = *currentSize; size_t tCount = *currentCount; UA_NodeId *tT = *current;
23150  *currentSize = *nextSize; *currentCount = *nextCount; *current = *next;
23151  *nextSize = tSize; *nextCount = tCount; *next = tT;
23152 
23153  /* Store the target name of the previous path element */
23154  targetName = &path->relativePath.elements[i].targetName;
23155  }
23156 
23157  UA_assert(targetName != NULL);
23158  UA_assert(*nextCount == 0);
23159 
23160  /* After the last BrowsePathElement, move members from current to the
23161  * result targets */
23162 
23163  /* Realloc if more space is needed */
23164  if(targetsSize < result->targetsSize + (*currentCount)) {
23165  UA_BrowsePathTarget *newTargets =
23167  (result->targetsSize + (*currentCount)));
23168  if(!newTargets) {
23170  for(size_t i = 0; i < *currentCount; ++i)
23171  UA_NodeId_deleteMembers(&(*current)[i]);
23172  *currentCount = 0;
23173  return;
23174  }
23175  result->targets = newTargets;
23176  }
23177 
23178  /* Move the elements of current to the targets */
23179  addBrowsePathTargets(server, session, result, targetName, *current, *currentCount);
23180  *currentCount = 0;
23181 }
23182 
23183 static void
23184 translateBrowsePathToNodeIds(UA_Server *server, UA_Session *session,
23185  const UA_BrowsePath *path, UA_BrowsePathResult *result) {
23186  if(path->relativePath.elementsSize <= 0) {
23188  return;
23189  }
23190 
23191  /* RelativePath elements must not have an empty targetName */
23192  for(size_t i = 0; i < path->relativePath.elementsSize; ++i) {
23193  if(UA_QualifiedName_isNull(&path->relativePath.elements[i].targetName)) {
23195  return;
23196  }
23197  }
23198 
23199  /* Allocate memory for the targets */
23200  size_t targetsSize = 10; /* When to realloc; the member count is stored in
23201  * result->targetsSize */
23202  result->targets = (UA_BrowsePathTarget*)UA_malloc(sizeof(UA_BrowsePathTarget) * targetsSize);
23203  if(!result->targets) {
23205  return;
23206  }
23207 
23208  /* Allocate memory for two temporary arrays. One with the results for the
23209  * previous depth of the path. The other for the new results at the current
23210  * depth. The two arrays alternate as we descend down the tree. */
23211  size_t currentSize = 10; /* When to realloc */
23212  size_t currentCount = 0; /* Current elements */
23213  UA_NodeId *current = (UA_NodeId*)UA_malloc(sizeof(UA_NodeId) * currentSize);
23214  if(!current) {
23216  UA_free(result->targets);
23217  return;
23218  }
23219  size_t nextSize = 10; /* When to realloc */
23220  size_t nextCount = 0; /* Current elements */
23221  UA_NodeId *next = (UA_NodeId*)UA_malloc(sizeof(UA_NodeId) * nextSize);
23222  if(!next) {
23224  UA_free(result->targets);
23225  UA_free(current);
23226  return;
23227  }
23228 
23229  /* Copy the starting node into current */
23230  result->statusCode = UA_NodeId_copy(&path->startingNode, &current[0]);
23231  if(result->statusCode != UA_STATUSCODE_GOOD) {
23232  UA_free(result->targets);
23233  UA_free(current);
23234  UA_free(next);
23235  return;
23236  }
23237  currentCount = 1;
23238 
23239  /* Walk the path elements */
23240  walkBrowsePath(server, session, path, result, targetsSize,
23241  &current, &currentSize, &currentCount,
23242  &next, &nextSize, &nextCount);
23243 
23244  UA_assert(currentCount == 0);
23245  UA_assert(nextCount == 0);
23246 
23247  /* No results => BadNoMatch status code */
23248  if(result->targetsSize == 0 && result->statusCode == UA_STATUSCODE_GOOD)
23250 
23251  /* Clean up the temporary arrays and the targets */
23252  UA_free(current);
23253  UA_free(next);
23254  if(result->statusCode != UA_STATUSCODE_GOOD) {
23255  for(size_t i = 0; i < result->targetsSize; ++i)
23256  UA_BrowsePathTarget_deleteMembers(&result->targets[i]);
23257  UA_free(result->targets);
23258  result->targets = NULL;
23259  result->targetsSize = 0;
23260  }
23261 }
23262 
23265  const UA_BrowsePath *browsePath) {
23266  UA_BrowsePathResult result;
23267  UA_BrowsePathResult_init(&result);
23268  UA_RCU_LOCK();
23269  translateBrowsePathToNodeIds(server, &adminSession, browsePath, &result);
23270  UA_RCU_UNLOCK();
23271  return result;
23272 }
23273 
23274 void Service_TranslateBrowsePathsToNodeIds(UA_Server *server, UA_Session *session,
23277  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing TranslateBrowsePathsToNodeIdsRequest");
23278  if(request->browsePathsSize <= 0) {
23280  return;
23281  }
23282 
23283  size_t size = request->browsePathsSize;
23285  if(!response->results) {
23287  return;
23288  }
23289 
23290  response->resultsSize = size;
23291  for(size_t i = 0; i < size; ++i)
23292  translateBrowsePathToNodeIds(server, session, &request->browsePaths[i],
23293  &response->results[i]);
23294 
23295 }
23296 
23297 void Service_RegisterNodes(UA_Server *server, UA_Session *session, const UA_RegisterNodesRequest *request,
23298  UA_RegisterNodesResponse *response) {
23299  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing RegisterNodesRequest");
23300  //TODO: hang the nodeids to the session if really needed
23302  if(request->nodesToRegisterSize <= 0)
23304  else {
23305  response->responseHeader.serviceResult =
23307  (void**)&response->registeredNodeIds, &UA_TYPES[UA_TYPES_NODEID]);
23309  response->registeredNodeIdsSize = request->nodesToRegisterSize;
23310  }
23311 }
23312 
23313 void Service_UnregisterNodes(UA_Server *server, UA_Session *session, const UA_UnregisterNodesRequest *request,
23314  UA_UnregisterNodesResponse *response) {
23315  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing UnRegisterNodesRequest");
23316  //TODO: remove the nodeids from the session if really needed
23318  if(request->nodesToUnregisterSize==0)
23320 }
23321 
23322 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_services_call.c" ***********************************/
23323 
23324 /* This Source Code Form is subject to the terms of the Mozilla Public
23325 * License, v. 2.0. If a copy of the MPL was not distributed with this
23326 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
23327 
23328 
23329 #ifdef UA_ENABLE_METHODCALLS /* conditional compilation */
23330 
23331 static const UA_VariableNode *
23332 getArgumentsVariableNode(UA_Server *server, const UA_MethodNode *ofMethod,
23333  UA_String withBrowseName) {
23334  UA_NodeId hasProperty = UA_NODEID_NUMERIC(0, UA_NS0ID_HASPROPERTY);
23335  for(size_t i = 0; i < ofMethod->referencesSize; ++i) {
23336  if(ofMethod->references[i].isInverse == false &&
23337  UA_NodeId_equal(&hasProperty, &ofMethod->references[i].referenceTypeId)) {
23338  const UA_Node *refTarget =
23339  UA_NodeStore_get(server->nodestore, &ofMethod->references[i].targetId.nodeId);
23340  if(!refTarget)
23341  continue;
23342  if(refTarget->nodeClass == UA_NODECLASS_VARIABLE &&
23343  refTarget->browseName.namespaceIndex == 0 &&
23344  UA_String_equal(&withBrowseName, &refTarget->browseName.name)) {
23345  return (const UA_VariableNode*) refTarget;
23346  }
23347  }
23348  }
23349  return NULL;
23350 }
23351 
23352 static UA_StatusCode
23353 argumentsConformsToDefinition(UA_Server *server, const UA_VariableNode *argRequirements,
23354  size_t argsSize, UA_Variant *args) {
23355  if(argRequirements->value.data.value.value.type != &UA_TYPES[UA_TYPES_ARGUMENT])
23357  UA_Argument *argReqs = (UA_Argument*)argRequirements->value.data.value.value.data;
23358  size_t argReqsSize = argRequirements->value.data.value.value.arrayLength;
23359  if(argRequirements->valueSource != UA_VALUESOURCE_DATA)
23361  if(UA_Variant_isScalar(&argRequirements->value.data.value.value))
23362  argReqsSize = 1;
23363  if(argReqsSize > argsSize)
23365  if(argReqsSize != argsSize)
23367 
23369  for(size_t i = 0; i < argReqsSize; ++i)
23370  retval |= typeCheckValue(server, &argReqs[i].dataType, argReqs[i].valueRank,
23371  argReqs[i].arrayDimensionsSize, argReqs[i].arrayDimensions,
23372  &args[i], NULL, &args[i]);
23373  return retval;
23374 }
23375 
23376 void
23377 Service_Call_single(UA_Server *server, UA_Session *session,
23378  const UA_CallMethodRequest *request,
23379  UA_CallMethodResult *result) {
23380  /* Get/verify the method node */
23381  const UA_MethodNode *methodCalled =
23382  (const UA_MethodNode*)UA_NodeStore_get(server->nodestore, &request->methodId);
23383  if(!methodCalled) {
23385  return;
23386  }
23387  if(methodCalled->nodeClass != UA_NODECLASS_METHOD) {
23389  return;
23390  }
23391  if(!methodCalled->executable || !methodCalled->userExecutable || !methodCalled->attachedMethod) {
23392  result->statusCode = UA_STATUSCODE_BADNOTWRITABLE; // There is no NOTEXECUTABLE?
23393  return;
23394  }
23395 
23396  /* Get/verify the object node */
23397  const UA_ObjectNode *withObject =
23398  (const UA_ObjectNode*)UA_NodeStore_get(server->nodestore, &request->objectId);
23399  if(!withObject) {
23401  return;
23402  }
23403  if(withObject->nodeClass != UA_NODECLASS_OBJECT && withObject->nodeClass != UA_NODECLASS_OBJECTTYPE) {
23405  return;
23406  }
23407 
23408  /* Verify method/object relations. Object must have a hasComponent or a
23409  * subtype of hasComponent reference to the method node. Therefore, check
23410  * every reference between the parent object and the method node if there is
23411  * a hasComponent (or subtype) reference */
23412  UA_Boolean found = false;
23413  UA_NodeId hasComponentNodeId = UA_NODEID_NUMERIC(0,UA_NS0ID_HASCOMPONENT);
23414  UA_NodeId hasSubTypeNodeId = UA_NODEID_NUMERIC(0,UA_NS0ID_HASSUBTYPE);
23415  for(size_t i = 0; i < methodCalled->referencesSize; ++i) {
23416  if(methodCalled->references[i].isInverse &&
23417  UA_NodeId_equal(&methodCalled->references[i].targetId.nodeId, &withObject->nodeId)) {
23418  found = isNodeInTree(server->nodestore, &methodCalled->references[i].referenceTypeId,
23419  &hasComponentNodeId, &hasSubTypeNodeId, 1);
23420  if(found)
23421  break;
23422  }
23423  }
23424  if(!found) {
23426  return;
23427  }
23428 
23429  /* Verify Input Argument count, types and sizes */
23430  const UA_VariableNode *inputArguments =
23431  getArgumentsVariableNode(server, methodCalled, UA_STRING("InputArguments"));
23432 
23433  if(!inputArguments) {
23434  if(request->inputArgumentsSize > 0) {
23436  return;
23437  }
23438  } else {
23439  result->statusCode = argumentsConformsToDefinition(server, inputArguments,
23440  request->inputArgumentsSize,
23441  request->inputArguments);
23442  if(result->statusCode != UA_STATUSCODE_GOOD)
23443  return;
23444  }
23445 
23446  /* Allocate the output arguments */
23447  result->outputArgumentsSize = 0; /* the default */
23448  const UA_VariableNode *outputArguments =
23449  getArgumentsVariableNode(server, methodCalled, UA_STRING("OutputArguments"));
23450  if(outputArguments) {
23451  result->outputArguments = UA_Array_new(outputArguments->value.data.value.value.arrayLength,
23453  if(!result->outputArguments) {
23455  return;
23456  }
23457  result->outputArgumentsSize = outputArguments->value.data.value.value.arrayLength;
23458  }
23459 
23460  /* Call the method */
23461 #if defined(UA_ENABLE_METHODCALLS) && defined(UA_ENABLE_SUBSCRIPTIONS)
23462  methodCallSession = session;
23463 #endif
23464  result->statusCode = methodCalled->attachedMethod(methodCalled->methodHandle, withObject->nodeId,
23465  request->inputArgumentsSize, request->inputArguments,
23466  result->outputArgumentsSize, result->outputArguments);
23467 #if defined(UA_ENABLE_METHODCALLS) && defined(UA_ENABLE_SUBSCRIPTIONS)
23468  methodCallSession = NULL;
23469 #endif
23470 
23471  /* TODO: Verify Output matches the argument definition */
23472 }
23473 
23474 void Service_Call(UA_Server *server, UA_Session *session,
23475  const UA_CallRequest *request,
23476  UA_CallResponse *response) {
23477  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing CallRequest");
23478  if(request->methodsToCallSize <= 0) {
23480  return;
23481  }
23482 
23484  if(!response->results) {
23486  return;
23487  }
23488  response->resultsSize = request->methodsToCallSize;
23489 
23490 
23491  for(size_t i = 0; i < request->methodsToCallSize;++i){
23492  Service_Call_single(server, session, &request->methodsToCall[i], &response->results[i]);
23493  }
23494 }
23495 
23497 UA_Server_call(UA_Server *server, const UA_CallMethodRequest *request) {
23498  UA_CallMethodResult result;
23499  UA_CallMethodResult_init(&result);
23500  Service_Call_single(server, &adminSession,
23501  request, &result);
23502  return result;
23503 }
23504 
23505 #endif /* UA_ENABLE_METHODCALLS */
23506 
23507 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_subscription.c" ***********************************/
23508 
23509 /* This Source Code Form is subject to the terms of the Mozilla Public
23510 * License, v. 2.0. If a copy of the MPL was not distributed with this
23511 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
23512 
23513 
23514 #ifdef UA_ENABLE_SUBSCRIPTIONS /* conditional compilation */
23515 
23516 #define UA_VALUENCODING_MAXSTACK 512
23517 
23518 /*****************/
23519 /* MonitoredItem */
23520 /*****************/
23521 
23524  if(!new)
23525  return NULL;
23526  new->subscription = NULL;
23527  new->currentQueueSize = 0;
23528  new->maxQueueSize = 0;
23529  new->monitoredItemType = UA_MONITOREDITEMTYPE_CHANGENOTIFY; /* currently hardcoded */
23530  new->timestampsToReturn = UA_TIMESTAMPSTORETURN_SOURCE;
23531  UA_String_init(&new->indexRange);
23532  TAILQ_INIT(&new->queue);
23533  UA_NodeId_init(&new->monitoredNodeId);
23534  new->lastSampledValue = UA_BYTESTRING_NULL;
23535  memset(&new->sampleJobGuid, 0, sizeof(UA_Guid));
23536  new->sampleJobIsRegistered = false;
23537  new->itemId = 0;
23538  return new;
23539 }
23540 
23541 void MonitoredItem_delete(UA_Server *server, UA_MonitoredItem *monitoredItem) {
23542  MonitoredItem_unregisterSampleJob(server, monitoredItem);
23543  /* clear the queued samples */
23544  MonitoredItem_queuedValue *val, *val_tmp;
23545  TAILQ_FOREACH_SAFE(val, &monitoredItem->queue, listEntry, val_tmp) {
23546  TAILQ_REMOVE(&monitoredItem->queue, val, listEntry);
23547  UA_DataValue_deleteMembers(&val->value);
23548  UA_free(val);
23549  }
23550  monitoredItem->currentQueueSize = 0;
23551  LIST_REMOVE(monitoredItem, listEntry);
23552  UA_String_deleteMembers(&monitoredItem->indexRange);
23553  UA_ByteString_deleteMembers(&monitoredItem->lastSampledValue);
23554  UA_NodeId_deleteMembers(&monitoredItem->monitoredNodeId);
23555  UA_free(monitoredItem);
23556 }
23557 
23558 static void
23559 ensureSpaceInMonitoredItemQueue(UA_MonitoredItem *mon) {
23560  if(mon->currentQueueSize < mon->maxQueueSize)
23561  return;
23562  MonitoredItem_queuedValue *queueItem;
23563  if(mon->discardOldest)
23564  queueItem = TAILQ_FIRST(&mon->queue);
23565  else
23566  queueItem = TAILQ_LAST(&mon->queue, QueueOfQueueDataValues);
23567  UA_assert(queueItem); /* When the currentQueueSize > 0, then there is an item */
23568  TAILQ_REMOVE(&mon->queue, queueItem, listEntry);
23569  UA_DataValue_deleteMembers(&queueItem->value);
23570  UA_free(queueItem);
23571  --mon->currentQueueSize;
23572 }
23573 
23574 /* Has this sample changed from the last one? The method may allocate additional
23575  * space for the encoding buffer. Detect the change in encoding->data. */
23576 static UA_StatusCode
23577 detectValueChange(UA_MonitoredItem *mon, UA_DataValue *value,
23578  UA_ByteString *encoding, UA_Boolean *changed) {
23579  /* Apply Filter */
23580  UA_Boolean hasValue = value->hasValue;
23581  if(mon->trigger == UA_DATACHANGETRIGGER_STATUS)
23582  value->hasValue = false;
23583 
23584  UA_Boolean hasServerTimestamp = value->hasServerTimestamp;
23585  UA_Boolean hasServerPicoseconds = value->hasServerPicoseconds;
23586  value->hasServerTimestamp = false;
23587  value->hasServerPicoseconds = false;
23588 
23589  UA_Boolean hasSourceTimestamp = value->hasSourceTimestamp;
23590  UA_Boolean hasSourcePicoseconds = value->hasSourcePicoseconds;
23591  if(mon->trigger < UA_DATACHANGETRIGGER_STATUSVALUETIMESTAMP) {
23592  value->hasSourceTimestamp = false;
23593  value->hasSourcePicoseconds = false;
23594  }
23595 
23596  /* Encode the data for comparison */
23598  size_t binsize = UA_calcSizeBinary(value, &UA_TYPES[UA_TYPES_DATAVALUE]);
23599  if(binsize == 0) {
23601  goto cleanup;
23602  }
23603 
23604  /* Allocate buffer on the heap if necessary */
23605  if(binsize > UA_VALUENCODING_MAXSTACK &&
23606  UA_ByteString_allocBuffer(encoding, binsize) != UA_STATUSCODE_GOOD) {
23608  goto cleanup;
23609  }
23610 
23611  /* Encode the value */
23612  size_t encodingOffset = 0;
23613  retval = UA_encodeBinary(value, &UA_TYPES[UA_TYPES_DATAVALUE],
23614  NULL, NULL, encoding, &encodingOffset);
23615  if(retval != UA_STATUSCODE_GOOD)
23616  goto cleanup;
23617 
23618  /* The value has changed */
23619  encoding->length = encodingOffset;
23620  if(!mon->lastSampledValue.data || !UA_String_equal(encoding, &mon->lastSampledValue))
23621  *changed = true;
23622 
23623  cleanup:
23624  /* Reset the filter */
23625  value->hasValue = hasValue;
23626  value->hasServerTimestamp = hasServerTimestamp;
23627  value->hasServerPicoseconds = hasServerPicoseconds;
23628  value->hasSourceTimestamp = hasSourceTimestamp;
23629  value->hasSourcePicoseconds = hasSourcePicoseconds;
23630  return retval;
23631 }
23632 
23633 void UA_MoniteredItem_SampleCallback(UA_Server *server, UA_MonitoredItem *monitoredItem) {
23634  UA_Subscription *sub = monitoredItem->subscription;
23635  if(monitoredItem->monitoredItemType != UA_MONITOREDITEMTYPE_CHANGENOTIFY) {
23636  UA_LOG_DEBUG_SESSION(server->config.logger, sub->session,
23637  "Subscription %u | MonitoredItem %i | "
23638  "Not a data change notification",
23639  sub->subscriptionID, monitoredItem->itemId);
23640  return;
23641  }
23642 
23643  /* Read the value */
23644  UA_ReadValueId rvid;
23645  UA_ReadValueId_init(&rvid);
23646  rvid.nodeId = monitoredItem->monitoredNodeId;
23647  rvid.attributeId = monitoredItem->attributeID;
23648  rvid.indexRange = monitoredItem->indexRange;
23649  UA_DataValue value;
23650  UA_DataValue_init(&value);
23651  Service_Read_single(server, sub->session, monitoredItem->timestampsToReturn,
23652  &rvid, &value);
23653 
23654  /* Stack-allocate some memory for the value encoding */
23655  UA_Byte *stackValueEncoding = UA_alloca(UA_VALUENCODING_MAXSTACK);
23656  UA_ByteString valueEncoding;
23657  valueEncoding.data = stackValueEncoding;
23658  valueEncoding.length = UA_VALUENCODING_MAXSTACK;
23659 
23660  /* Has the value changed? */
23661  UA_Boolean changed = false;
23662  UA_StatusCode retval = detectValueChange(monitoredItem, &value,
23663  &valueEncoding, &changed);
23664  if(!changed || retval != UA_STATUSCODE_GOOD)
23665  goto cleanup;
23666 
23667  /* Allocate the entry for the publish queue */
23669  if(!newQueueItem) {
23670  UA_LOG_WARNING_SESSION(server->config.logger, sub->session,
23671  "Subscription %u | MonitoredItem %i | "
23672  "Item for the publishing queue could not be allocated",
23673  sub->subscriptionID, monitoredItem->itemId);
23674  goto cleanup;
23675  }
23676 
23677  /* Copy valueEncoding on the heap for the next comparison (if not already done) */
23678  if(valueEncoding.data == stackValueEncoding) {
23679  UA_ByteString cbs;
23680  if(UA_ByteString_copy(&valueEncoding, &cbs) != UA_STATUSCODE_GOOD) {
23681  UA_LOG_WARNING_SESSION(server->config.logger, sub->session,
23682  "Subscription %u | MonitoredItem %i | "
23683  "ByteString to compare values could not be created",
23684  sub->subscriptionID, monitoredItem->itemId);
23685  UA_free(newQueueItem);
23686  goto cleanup;
23687  }
23688  valueEncoding = cbs;
23689  }
23690 
23691  /* Prepare the newQueueItem */
23692  if(value.hasValue && value.value.storageType == UA_VARIANT_DATA_NODELETE) {
23693  if(UA_DataValue_copy(&value, &newQueueItem->value) != UA_STATUSCODE_GOOD) {
23694  UA_LOG_WARNING_SESSION(server->config.logger, sub->session,
23695  "Subscription %u | MonitoredItem %i | "
23696  "Item for the publishing queue could not be prepared",
23697  sub->subscriptionID, monitoredItem->itemId);
23698  UA_free(newQueueItem);
23699  goto cleanup;
23700  }
23701  } else {
23702  newQueueItem->value = value;
23703  }
23704  newQueueItem->clientHandle = monitoredItem->clientHandle;
23705 
23706  /* <-- Point of no return --> */
23707 
23708  UA_LOG_DEBUG_SESSION(server->config.logger, sub->session,
23709  "Subscription %u | MonitoredItem %u | Sampled a new value",
23710  sub->subscriptionID, monitoredItem->itemId);
23711 
23712  /* Replace the encoding for comparison */
23713  UA_ByteString_deleteMembers(&monitoredItem->lastSampledValue);
23714  monitoredItem->lastSampledValue = valueEncoding;
23715 
23716  /* Add the sample to the queue for publication */
23717  ensureSpaceInMonitoredItemQueue(monitoredItem);
23718  TAILQ_INSERT_TAIL(&monitoredItem->queue, newQueueItem, listEntry);
23719  ++monitoredItem->currentQueueSize;
23720  return;
23721 
23722  cleanup:
23723  if(valueEncoding.data != stackValueEncoding)
23724  UA_ByteString_deleteMembers(&valueEncoding);
23725  UA_DataValue_deleteMembers(&value);
23726 }
23727 
23729 MonitoredItem_registerSampleJob(UA_Server *server, UA_MonitoredItem *mon) {
23730  UA_Job job;
23731  job.type = UA_JOBTYPE_METHODCALL;
23732  job.job.methodCall.method = (UA_ServerCallback)UA_MoniteredItem_SampleCallback;
23733  job.job.methodCall.data = mon;
23734  UA_StatusCode retval = UA_Server_addRepeatedJob(server, job,
23735  (UA_UInt32)mon->samplingInterval,
23736  &mon->sampleJobGuid);
23737  if(retval == UA_STATUSCODE_GOOD)
23738  mon->sampleJobIsRegistered = true;
23739  return retval;
23740 }
23741 
23743  if(!mon->sampleJobIsRegistered)
23744  return UA_STATUSCODE_GOOD;
23745  mon->sampleJobIsRegistered = false;
23746  return UA_Server_removeRepeatedJob(server, mon->sampleJobGuid);
23747 }
23748 
23749 /****************/
23750 /* Subscription */
23751 /****************/
23752 
23753 UA_Subscription * UA_Subscription_new(UA_Session *session, UA_UInt32 subscriptionID) {
23754  UA_Subscription *new = UA_malloc(sizeof(UA_Subscription));
23755  if(!new)
23756  return NULL;
23757  new->session = session;
23758  new->subscriptionID = subscriptionID;
23759  new->sequenceNumber = 0;
23760  new->maxKeepAliveCount = 0;
23761  new->publishingEnabled = false;
23762  memset(&new->publishJobGuid, 0, sizeof(UA_Guid));
23763  new->publishJobIsRegistered = false;
23764  new->currentKeepAliveCount = 0;
23765  new->currentLifetimeCount = 0;
23766  new->lastMonitoredItemId = 0;
23767  new->state = UA_SUBSCRIPTIONSTATE_NORMAL; /* The first publish response is sent immediately */
23768  LIST_INIT(&new->monitoredItems);
23769  TAILQ_INIT(&new->retransmissionQueue);
23770  new->retransmissionQueueSize = 0;
23771  return new;
23772 }
23773 
23774 void UA_Subscription_deleteMembers(UA_Subscription *subscription, UA_Server *server) {
23775  Subscription_unregisterPublishJob(server, subscription);
23776 
23777  /* Delete monitored Items */
23778  UA_MonitoredItem *mon, *tmp_mon;
23779  LIST_FOREACH_SAFE(mon, &subscription->monitoredItems, listEntry, tmp_mon) {
23780  LIST_REMOVE(mon, listEntry);
23781  MonitoredItem_delete(server, mon);
23782  }
23783 
23784  /* Delete Retransmission Queue */
23785  UA_NotificationMessageEntry *nme, *nme_tmp;
23786  TAILQ_FOREACH_SAFE(nme, &subscription->retransmissionQueue, listEntry, nme_tmp) {
23787  TAILQ_REMOVE(&subscription->retransmissionQueue, nme, listEntry);
23788  UA_NotificationMessage_deleteMembers(&nme->message);
23789  UA_free(nme);
23790  }
23791  subscription->retransmissionQueueSize = 0;
23792 }
23793 
23796  UA_MonitoredItem *mon;
23797  LIST_FOREACH(mon, &sub->monitoredItems, listEntry) {
23798  if(mon->itemId == monitoredItemID)
23799  break;
23800  }
23801  return mon;
23802 }
23803 
23806  UA_UInt32 monitoredItemID) {
23807  UA_MonitoredItem *mon;
23808  LIST_FOREACH(mon, &sub->monitoredItems, listEntry) {
23809  if(mon->itemId == monitoredItemID) {
23810  LIST_REMOVE(mon, listEntry);
23811  MonitoredItem_delete(server, mon);
23812  return UA_STATUSCODE_GOOD;
23813  }
23814  }
23816 }
23817 
23818 static size_t
23819 countQueuedNotifications(UA_Subscription *sub, UA_Boolean *moreNotifications) {
23820  size_t notifications = 0;
23821  if(sub->publishingEnabled) {
23822  UA_MonitoredItem *mon;
23823  LIST_FOREACH(mon, &sub->monitoredItems, listEntry) {
23825  TAILQ_FOREACH(qv, &mon->queue, listEntry) {
23826  if(notifications >= sub->notificationsPerPublish) {
23827  *moreNotifications = true;
23828  break;
23829  }
23830  ++notifications;
23831  }
23832  }
23833  }
23834  return notifications;
23835 }
23836 
23837 static void
23838 UA_Subscription_addRetransmissionMessage(UA_Server *server, UA_Subscription *sub,
23839  UA_NotificationMessageEntry *entry) {
23840  /* Release the oldest entry if there is not enough space */
23841  if(server->config.maxRetransmissionQueueSize > 0 &&
23842  sub->retransmissionQueueSize >= server->config.maxRetransmissionQueueSize) {
23843  UA_NotificationMessageEntry *lastentry =
23844  TAILQ_LAST(&sub->retransmissionQueue, UA_ListOfNotificationMessages);
23845  TAILQ_REMOVE(&sub->retransmissionQueue, lastentry, listEntry);
23846  --sub->retransmissionQueueSize;
23847  UA_NotificationMessage_deleteMembers(&lastentry->message);
23848  UA_free(lastentry);
23849  }
23850 
23851  /* Add entry */
23852  TAILQ_INSERT_HEAD(&sub->retransmissionQueue, entry, listEntry);
23853  ++sub->retransmissionQueueSize;
23854 }
23855 
23858  UA_NotificationMessageEntry *entry, *entry_tmp;
23859  TAILQ_FOREACH_SAFE(entry, &sub->retransmissionQueue, listEntry, entry_tmp) {
23860  if(entry->message.sequenceNumber != sequenceNumber)
23861  continue;
23862  TAILQ_REMOVE(&sub->retransmissionQueue, entry, listEntry);
23863  --sub->retransmissionQueueSize;
23864  UA_NotificationMessage_deleteMembers(&entry->message);
23865  UA_free(entry);
23866  return UA_STATUSCODE_GOOD;
23867  }
23869 }
23870 
23871 static UA_StatusCode
23872 prepareNotificationMessage(UA_Subscription *sub, UA_NotificationMessage *message,
23873  size_t notifications) {
23874  /* Array of ExtensionObject to hold different kinds of notifications
23875  (currently only DataChangeNotifications) */
23877  if(!message->notificationData)
23879  message->notificationDataSize = 1;
23880 
23881  /* Allocate Notification */
23882  UA_DataChangeNotification *dcn = UA_DataChangeNotification_new();
23883  if(!dcn)
23884  goto cleanup;
23885  UA_ExtensionObject *data = message->notificationData;
23887  data->content.decoded.data = dcn;
23889 
23890  /* Allocate array of notifications */
23891  dcn->monitoredItems =
23893  if(!dcn->monitoredItems)
23894  goto cleanup;
23895  dcn->monitoredItemsSize = notifications;
23896 
23897  /* Move notifications into the response .. the point of no return */
23898  size_t l = 0;
23899  UA_MonitoredItem *mon;
23900  LIST_FOREACH(mon, &sub->monitoredItems, listEntry) {
23901  MonitoredItem_queuedValue *qv, *qv_tmp;
23902  TAILQ_FOREACH_SAFE(qv, &mon->queue, listEntry, qv_tmp) {
23903  if(l >= notifications)
23904  return UA_STATUSCODE_GOOD;
23906  min->clientHandle = qv->clientHandle;
23907  min->value = qv->value;
23908  TAILQ_REMOVE(&mon->queue, qv, listEntry);
23909  UA_free(qv);
23910  --mon->currentQueueSize;
23911  ++l;
23912  }
23913  }
23914  return UA_STATUSCODE_GOOD;
23915 
23916  cleanup:
23917  UA_NotificationMessage_deleteMembers(message);
23919 }
23920 
23921 void UA_Subscription_publishCallback(UA_Server *server, UA_Subscription *sub) {
23922  UA_LOG_DEBUG_SESSION(server->config.logger, sub->session, "Subscription %u | "
23923  "Publish Callback", sub->subscriptionID);
23924 
23925  /* Count the available notifications */
23926  UA_Boolean moreNotifications = false;
23927  size_t notifications = countQueuedNotifications(sub, &moreNotifications);
23928 
23929  /* Return if nothing to do */
23930  if(notifications == 0) {
23931  ++sub->currentKeepAliveCount;
23932  if(sub->currentKeepAliveCount < sub->maxKeepAliveCount)
23933  return;
23934  UA_LOG_DEBUG_SESSION(server->config.logger, sub->session,
23935  "Subscription %u | Sending a KeepAlive",
23936  sub->subscriptionID)
23937  }
23938 
23939  /* Check if the securechannel is valid */
23940  UA_SecureChannel *channel = sub->session->channel;
23941  if(!channel)
23942  return;
23943 
23944  /* Dequeue a response */
23945  UA_PublishResponseEntry *pre = SIMPLEQ_FIRST(&sub->session->responseQueue);
23946 
23947  /* Cannot publish without a response */
23948  if(!pre) {
23949  UA_LOG_DEBUG_SESSION(server->config.logger, sub->session,
23950  "Subscription %u | Cannot send a publish response "
23951  "since the publish queue is empty", sub->subscriptionID)
23952  if(sub->state != UA_SUBSCRIPTIONSTATE_LATE) {
23953  sub->state = UA_SUBSCRIPTIONSTATE_LATE;
23954  } else {
23955  ++sub->currentLifetimeCount;
23956  if(sub->currentLifetimeCount > sub->lifeTimeCount) {
23957  UA_LOG_DEBUG_SESSION(server->config.logger, sub->session, "Subscription %u | "
23958  "End of lifetime for subscription", sub->subscriptionID);
23959  UA_Session_deleteSubscription(server, sub->session, sub->subscriptionID);
23960  }
23961  }
23962  return;
23963  }
23964 
23965  UA_PublishResponse *response = &pre->response;
23966  UA_NotificationMessage *message = &response->notificationMessage;
23967  UA_NotificationMessageEntry *retransmission = NULL;
23968  if(notifications > 0) {
23969  /* Allocate the retransmission entry */
23970  retransmission = UA_malloc(sizeof(UA_NotificationMessageEntry));
23971  if(!retransmission) {
23972  UA_LOG_WARNING_SESSION(server->config.logger, sub->session,
23973  "Subscription %u | Could not allocate memory "
23974  "for retransmission", sub->subscriptionID);
23975  return;
23976  }
23977  /* Prepare the response */
23978  UA_StatusCode retval =
23979  prepareNotificationMessage(sub, message, notifications);
23980  if(retval != UA_STATUSCODE_GOOD) {
23981  UA_LOG_WARNING_SESSION(server->config.logger, sub->session,
23982  "Subscription %u | Could not prepare the "
23983  "notification message", sub->subscriptionID);
23984  UA_free(retransmission);
23985  return;
23986  }
23987  }
23988 
23989  /* <-- The point of no return --> */
23990 
23991  /* Remove the response from the response queue */
23992  SIMPLEQ_REMOVE_HEAD(&sub->session->responseQueue, listEntry);
23993 
23994  /* Set up the response */
23996  response->subscriptionId = sub->subscriptionID;
23997  response->moreNotifications = moreNotifications;
23998  message->publishTime = response->responseHeader.timestamp;
23999  if(notifications == 0) {
24000  /* Send sequence number for the next notification */
24001  message->sequenceNumber = sub->sequenceNumber + 1;
24002  } else {
24003  /* Increase the sequence number */
24004  message->sequenceNumber = ++sub->sequenceNumber;
24005 
24006  /* Put the notification message into the retransmission queue. This needs to
24007  * be done here, so that the message itself is included in the available
24008  * sequence numbers for acknowledgement. */
24009  retransmission->message = response->notificationMessage;
24010  UA_Subscription_addRetransmissionMessage(server, sub, retransmission);
24011  }
24012 
24013  /* Get the available sequence numbers from the retransmission queue */
24014  size_t available = sub->retransmissionQueueSize;
24015  if(available > 0) {
24016  response->availableSequenceNumbers = UA_alloca(available * sizeof(UA_UInt32));
24017  response->availableSequenceNumbersSize = available;
24018  size_t i = 0;
24020  TAILQ_FOREACH(nme, &sub->retransmissionQueue, listEntry) {
24021  response->availableSequenceNumbers[i] = nme->message.sequenceNumber;
24022  ++i;
24023  }
24024  }
24025 
24026  /* Send the response */
24027  UA_LOG_DEBUG_SESSION(server->config.logger, sub->session,
24028  "Subscription %u | Sending out a publish response with %u "
24029  "notifications", sub->subscriptionID, (UA_UInt32)notifications);
24030  UA_SecureChannel_sendBinaryMessage(sub->session->channel, pre->requestId, response,
24032 
24033  /* Reset subscription state to normal. */
24034  sub->state = UA_SUBSCRIPTIONSTATE_NORMAL;
24035  sub->currentKeepAliveCount = 0;
24036  sub->currentLifetimeCount = 0;
24037 
24038  /* Free the response */
24039  UA_Array_delete(response->results, response->resultsSize,
24041  UA_free(pre); /* no need for UA_PublishResponse_deleteMembers */
24042 
24043  /* Repeat if there are more notifications to send */
24044  if(moreNotifications)
24045  UA_Subscription_publishCallback(server, sub);
24046 }
24047 
24049 Subscription_registerPublishJob(UA_Server *server, UA_Subscription *sub) {
24050  if(sub->publishJobIsRegistered)
24051  return UA_STATUSCODE_GOOD;
24052 
24053  UA_LOG_DEBUG_SESSION(server->config.logger, sub->session,
24054  "Subscription %u | Register subscription publishing callback",
24055  sub->subscriptionID);
24056  UA_Job job;
24057  job.type = UA_JOBTYPE_METHODCALL;
24058  job.job.methodCall.method = (UA_ServerCallback)UA_Subscription_publishCallback;
24059  job.job.methodCall.data = sub;
24060  UA_StatusCode retval =
24061  UA_Server_addRepeatedJob(server, job, (UA_UInt32)sub->publishingInterval,
24062  &sub->publishJobGuid);
24063  if(retval == UA_STATUSCODE_GOOD)
24064  sub->publishJobIsRegistered = true;
24065  return retval;
24066 }
24067 
24069 Subscription_unregisterPublishJob(UA_Server *server, UA_Subscription *sub) {
24070  if(!sub->publishJobIsRegistered)
24071  return UA_STATUSCODE_GOOD;
24072  UA_LOG_DEBUG_SESSION(server->config.logger, sub->session,
24073  "Subscription %u | Unregister subscription publishing callback",
24074  sub->subscriptionID);
24075  sub->publishJobIsRegistered = false;
24076  return UA_Server_removeRepeatedJob(server, sub->publishJobGuid);
24077 }
24078 
24079 /* When the session has publish requests stored but the last subscription is
24080  deleted... Send out empty responses */
24081 void
24082 UA_Subscription_answerPublishRequestsNoSubscription(UA_Server *server, UA_NodeId *sessionToken) {
24083  /* Get session */
24084  UA_Session *session = UA_SessionManager_getSession(&server->sessionManager, sessionToken);
24085  UA_NodeId_delete(sessionToken);
24086 
24087  /* No session or there are remaining subscriptions */
24088  if(!session || LIST_FIRST(&session->serverSubscriptions))
24089  return;
24090 
24091  /* Send a response for every queued request */
24092  UA_PublishResponseEntry *pre;
24093  while((pre = SIMPLEQ_FIRST(&session->responseQueue))) {
24094  SIMPLEQ_REMOVE_HEAD(&session->responseQueue, listEntry);
24095  UA_PublishResponse *response = &pre->response;
24098  UA_SecureChannel_sendBinaryMessage(session->channel, pre->requestId, response,
24100  UA_PublishResponse_deleteMembers(response);
24101  UA_free(pre);
24102  }
24103 }
24104 
24105 #endif /* UA_ENABLE_SUBSCRIPTIONS */
24106 
24107 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_services_subscription.c" ***********************************/
24108 
24109 /* This Source Code Form is subject to the terms of the Mozilla Public
24110 * License, v. 2.0. If a copy of the MPL was not distributed with this
24111 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
24112 
24113 
24114 #ifdef UA_ENABLE_SUBSCRIPTIONS /* conditional compilation */
24115 
24116 #define UA_BOUNDEDVALUE_SETWBOUNDS(BOUNDS, SRC, DST) { \
24117  if(SRC > BOUNDS.max) DST = BOUNDS.max; \
24118  else if(SRC < BOUNDS.min) DST = BOUNDS.min; \
24119  else DST = SRC; \
24120  }
24121 
24122 static void
24123 setSubscriptionSettings(UA_Server *server, UA_Subscription *subscription,
24124  UA_Double requestedPublishingInterval,
24125  UA_UInt32 requestedLifetimeCount,
24126  UA_UInt32 requestedMaxKeepAliveCount,
24127  UA_UInt32 maxNotificationsPerPublish, UA_Byte priority) {
24128  /* deregister the job if required */
24129  UA_StatusCode retval = Subscription_unregisterPublishJob(server, subscription);
24130  if(retval != UA_STATUSCODE_GOOD)
24131  UA_LOG_DEBUG_SESSION(server->config.logger, subscription->session, "Subscription %u | "
24132  "Could not unregister publish job with error code 0x%08x",
24133  subscription->subscriptionID, retval);
24134 
24135  /* re-parameterize the subscription */
24136  subscription->publishingInterval = requestedPublishingInterval;
24137  UA_BOUNDEDVALUE_SETWBOUNDS(server->config.publishingIntervalLimits,
24138  requestedPublishingInterval, subscription->publishingInterval);
24139  /* check for nan*/
24140  if(requestedPublishingInterval != requestedPublishingInterval)
24141  subscription->publishingInterval = server->config.publishingIntervalLimits.min;
24142  UA_BOUNDEDVALUE_SETWBOUNDS(server->config.keepAliveCountLimits,
24143  requestedMaxKeepAliveCount, subscription->maxKeepAliveCount);
24144  UA_BOUNDEDVALUE_SETWBOUNDS(server->config.lifeTimeCountLimits,
24145  requestedLifetimeCount, subscription->lifeTimeCount);
24146  if(subscription->lifeTimeCount < 3 * subscription->maxKeepAliveCount)
24147  subscription->lifeTimeCount = 3 * subscription->maxKeepAliveCount;
24148  subscription->notificationsPerPublish = maxNotificationsPerPublish;
24149  if(maxNotificationsPerPublish == 0 ||
24150  maxNotificationsPerPublish > server->config.maxNotificationsPerPublish)
24151  subscription->notificationsPerPublish = server->config.maxNotificationsPerPublish;
24152  subscription->priority = priority;
24153 
24154  retval = Subscription_registerPublishJob(server, subscription);
24155  if(retval != UA_STATUSCODE_GOOD)
24156  UA_LOG_DEBUG_SESSION(server->config.logger, subscription->session, "Subscription %u | "
24157  "Could not register publish job with error code 0x%08x",
24158  subscription->subscriptionID, retval);
24159 }
24160 
24161 void
24162 Service_CreateSubscription(UA_Server *server, UA_Session *session,
24163  const UA_CreateSubscriptionRequest *request,
24164  UA_CreateSubscriptionResponse *response) {
24165  /* Create the subscription */
24166  UA_Subscription *newSubscription = UA_Subscription_new(session, response->subscriptionId);
24167  if(!newSubscription) {
24168  UA_LOG_DEBUG_SESSION(server->config.logger, session,
24169  "Processing CreateSubscriptionRequest failed");
24171  return;
24172  }
24173  newSubscription->subscriptionID = UA_Session_getUniqueSubscriptionID(session);
24174  UA_Session_addSubscription(session, newSubscription);
24175 
24176  /* Set the subscription parameters */
24177  newSubscription->publishingEnabled = request->publishingEnabled;
24178  setSubscriptionSettings(server, newSubscription, request->requestedPublishingInterval,
24180  request->maxNotificationsPerPublish, request->priority);
24181  newSubscription->currentKeepAliveCount = newSubscription->maxKeepAliveCount; /* set settings first */
24182 
24183  /* Prepare the response */
24184  response->subscriptionId = newSubscription->subscriptionID;
24185  response->revisedPublishingInterval = newSubscription->publishingInterval;
24186  response->revisedLifetimeCount = newSubscription->lifeTimeCount;
24187  response->revisedMaxKeepAliveCount = newSubscription->maxKeepAliveCount;
24188 
24189  UA_LOG_DEBUG_SESSION(server->config.logger, session,
24190  "CreateSubscriptionRequest: Created Subscription %u "
24191  "with a publishing interval of %f ms", response->subscriptionId,
24192  newSubscription->publishingInterval);
24193 }
24194 
24195 void
24196 Service_ModifySubscription(UA_Server *server, UA_Session *session,
24197  const UA_ModifySubscriptionRequest *request,
24198  UA_ModifySubscriptionResponse *response) {
24199  UA_LOG_DEBUG_SESSION(server->config.logger, session,
24200  "Processing ModifySubscriptionRequest");
24201  UA_Subscription *sub = UA_Session_getSubscriptionByID(session, request->subscriptionId);
24202  if(!sub) {
24204  return;
24205  }
24206 
24207  setSubscriptionSettings(server, sub, request->requestedPublishingInterval,
24209  request->maxNotificationsPerPublish, request->priority);
24210  sub->currentLifetimeCount = 0; /* Reset the subscription lifetime */
24211  response->revisedPublishingInterval = sub->publishingInterval;
24212  response->revisedLifetimeCount = sub->lifeTimeCount;
24213  response->revisedMaxKeepAliveCount = sub->maxKeepAliveCount;
24214 }
24215 
24216 void
24217 Service_SetPublishingMode(UA_Server *server, UA_Session *session,
24218  const UA_SetPublishingModeRequest *request,
24219  UA_SetPublishingModeResponse *response) {
24220  UA_LOG_DEBUG_SESSION(server->config.logger, session,
24221  "Processing SetPublishingModeRequest");
24222  if(request->subscriptionIdsSize <= 0) {
24224  return;
24225  }
24226 
24227  size_t size = request->subscriptionIdsSize;
24228  response->results = UA_Array_new(size, &UA_TYPES[UA_TYPES_STATUSCODE]);
24229  if(!response->results) {
24231  return;
24232  }
24233 
24234  response->resultsSize = size;
24235  for(size_t i = 0; i < size; ++i) {
24236  UA_Subscription *sub =
24237  UA_Session_getSubscriptionByID(session, request->subscriptionIds[i]);
24238  if(!sub) {
24240  continue;
24241  }
24242  if(sub->publishingEnabled != request->publishingEnabled) {
24243  sub->publishingEnabled = request->publishingEnabled;
24244  sub->currentLifetimeCount = 0; /* Reset the subscription lifetime */
24245  }
24246  }
24247 }
24248 
24249 static void
24250 setMonitoredItemSettings(UA_Server *server, UA_MonitoredItem *mon,
24251  UA_MonitoringMode monitoringMode,
24252  const UA_MonitoringParameters *params) {
24253  MonitoredItem_unregisterSampleJob(server, mon);
24254  mon->monitoringMode = monitoringMode;
24255 
24256  /* ClientHandle */
24257  mon->clientHandle = params->clientHandle;
24258 
24259  /* SamplingInterval */
24260  UA_Double samplingInterval = params->samplingInterval;
24261  if(mon->attributeID == UA_ATTRIBUTEID_VALUE) {
24262  const UA_VariableNode *vn = (const UA_VariableNode*)
24263  UA_NodeStore_get(server->nodestore, &mon->monitoredNodeId);
24264  if(vn && vn->nodeClass == UA_NODECLASS_VARIABLE &&
24265  samplingInterval < vn->minimumSamplingInterval)
24266  samplingInterval = vn->minimumSamplingInterval;
24267  } else if(mon->attributeID == UA_ATTRIBUTEID_EVENTNOTIFIER) {
24268  /* TODO: events should not need a samplinginterval */
24269  samplingInterval = 10000.0f; // 10 seconds to reduce the load
24270  }
24271  mon->samplingInterval = samplingInterval;
24272  UA_BOUNDEDVALUE_SETWBOUNDS(server->config.samplingIntervalLimits,
24273  samplingInterval, mon->samplingInterval);
24274  if(samplingInterval != samplingInterval) /* Check for nan */
24275  mon->samplingInterval = server->config.samplingIntervalLimits.min;
24276 
24277  /* Filter */
24278  if(params->filter.encoding != UA_EXTENSIONOBJECT_DECODED ||
24280  /* Default: Trigger only on the value and the statuscode */
24281  mon->trigger = UA_DATACHANGETRIGGER_STATUSVALUE;
24282  } else {
24283  UA_DataChangeFilter *filter = params->filter.content.decoded.data;
24284  mon->trigger = filter->trigger;
24285  }
24286 
24287  /* QueueSize */
24288  UA_BOUNDEDVALUE_SETWBOUNDS(server->config.queueSizeLimits,
24289  params->queueSize, mon->maxQueueSize);
24290 
24291  /* DiscardOldest */
24292  mon->discardOldest = params->discardOldest;
24293 
24294  /* Register sample job if reporting is enabled */
24295  if(monitoringMode == UA_MONITORINGMODE_REPORTING)
24296  MonitoredItem_registerSampleJob(server, mon);
24297 }
24298 
24299 static const UA_String binaryEncoding = {sizeof("Default Binary")-1, (UA_Byte*)"Default Binary"};
24300 /* static const UA_String xmlEncoding = {sizeof("Default Xml")-1, (UA_Byte*)"Default Xml"}; */
24301 
24302 static void
24303 Service_CreateMonitoredItems_single(UA_Server *server, UA_Session *session,
24304  UA_Subscription *sub,
24305  const UA_TimestampsToReturn timestampsToReturn,
24306  const UA_MonitoredItemCreateRequest *request,
24307  UA_MonitoredItemCreateResult *result) {
24308  /* Make an example read to get errors in the itemToMonitor. Allow return
24309  * codes "good" and "uncertain", as well as a list of statuscodes that might
24310  * be repaired inside the data source. */
24311  UA_DataValue v;
24312  UA_DataValue_init(&v);
24313  Service_Read_single(server, session, timestampsToReturn, &request->itemToMonitor, &v);
24314  if(v.hasStatus && (v.status >> 30) > 1 &&
24318  result->statusCode = v.status;
24319  UA_DataValue_deleteMembers(&v);
24320  return;
24321  }
24322  UA_DataValue_deleteMembers(&v);
24323 
24324  /* Check if the encoding is supported */
24325  if(request->itemToMonitor.dataEncoding.name.length > 0 &&
24326  (!UA_String_equal(&binaryEncoding, &request->itemToMonitor.dataEncoding.name) ||
24327  request->itemToMonitor.dataEncoding.namespaceIndex != 0)) {
24329  return;
24330  }
24331 
24332  /* Check if the encoding is set for a value */
24334  request->itemToMonitor.dataEncoding.name.length > 0) {
24336  return;
24337  }
24338 
24339  /* Create the monitoreditem */
24341  if(!newMon) {
24343  return;
24344  }
24345  UA_StatusCode retval = UA_NodeId_copy(&request->itemToMonitor.nodeId,
24346  &newMon->monitoredNodeId);
24347  if(retval != UA_STATUSCODE_GOOD) {
24348  result->statusCode = retval;
24349  MonitoredItem_delete(server, newMon);
24350  return;
24351  }
24352  newMon->subscription = sub;
24353  newMon->attributeID = request->itemToMonitor.attributeId;
24354  newMon->itemId = ++(sub->lastMonitoredItemId);
24355  newMon->timestampsToReturn = timestampsToReturn;
24356  setMonitoredItemSettings(server, newMon, request->monitoringMode,
24357  &request->requestedParameters);
24358  LIST_INSERT_HEAD(&sub->monitoredItems, newMon, listEntry);
24359 
24360  /* Create the first sample */
24362  UA_MoniteredItem_SampleCallback(server, newMon);
24363 
24364  /* Prepare the response */
24365  UA_String_copy(&request->itemToMonitor.indexRange, &newMon->indexRange);
24366  result->revisedSamplingInterval = newMon->samplingInterval;
24367  result->revisedQueueSize = newMon->maxQueueSize;
24368  result->monitoredItemId = newMon->itemId;
24369 }
24370 
24371 void
24372 Service_CreateMonitoredItems(UA_Server *server, UA_Session *session,
24373  const UA_CreateMonitoredItemsRequest *request,
24374  UA_CreateMonitoredItemsResponse *response) {
24375  UA_LOG_DEBUG_SESSION(server->config.logger, session,
24376  "Processing CreateMonitoredItemsRequest");
24377 
24378  /* Check if the timestampstoreturn is valid */
24381  return;
24382  }
24383 
24384  UA_Subscription *sub = UA_Session_getSubscriptionByID(session, request->subscriptionId);
24385  if(!sub) {
24387  return;
24388  }
24389 
24390  /* Reset the subscription lifetime */
24391  sub->currentLifetimeCount = 0;
24392  if(request->itemsToCreateSize <= 0) {
24394  return;
24395  }
24396 
24397  response->results = UA_Array_new(request->itemsToCreateSize,
24399  if(!response->results) {
24401  return;
24402  }
24403  response->resultsSize = request->itemsToCreateSize;
24404 
24405  for(size_t i = 0; i < request->itemsToCreateSize; ++i)
24406  Service_CreateMonitoredItems_single(server, session, sub, request->timestampsToReturn,
24407  &request->itemsToCreate[i], &response->results[i]);
24408 }
24409 
24410 static void
24411 Service_ModifyMonitoredItems_single(UA_Server *server, UA_Session *session, UA_Subscription *sub,
24412  const UA_MonitoredItemModifyRequest *request,
24413  UA_MonitoredItemModifyResult *result) {
24415  if(!mon) {
24417  return;
24418  }
24419 
24420  setMonitoredItemSettings(server, mon, mon->monitoringMode,
24421  &request->requestedParameters);
24422  result->revisedSamplingInterval = mon->samplingInterval;
24423  result->revisedQueueSize = mon->maxQueueSize;
24424 }
24425 
24426 void Service_ModifyMonitoredItems(UA_Server *server, UA_Session *session,
24427  const UA_ModifyMonitoredItemsRequest *request,
24428  UA_ModifyMonitoredItemsResponse *response) {
24429  UA_LOG_DEBUG_SESSION(server->config.logger, session,
24430  "Processing ModifyMonitoredItemsRequest");
24431 
24432  /* check if the timestampstoreturn is valid */
24435  return;
24436  }
24437 
24438  /* Get the subscription */
24439  UA_Subscription *sub = UA_Session_getSubscriptionByID(session, request->subscriptionId);
24440  if(!sub) {
24442  return;
24443  }
24444 
24445  /* Reset the subscription lifetime */
24446  sub->currentLifetimeCount = 0;
24447  if(request->itemsToModifySize <= 0) {
24449  return;
24450  }
24451 
24452  response->results = UA_Array_new(request->itemsToModifySize,
24454  if(!response->results) {
24456  return;
24457  }
24458  response->resultsSize = request->itemsToModifySize;
24459 
24460  for(size_t i = 0; i < request->itemsToModifySize; ++i)
24461  Service_ModifyMonitoredItems_single(server, session, sub, &request->itemsToModify[i],
24462  &response->results[i]);
24463 
24464 }
24465 
24466 void Service_SetMonitoringMode(UA_Server *server, UA_Session *session,
24467  const UA_SetMonitoringModeRequest *request,
24468  UA_SetMonitoringModeResponse *response) {
24469  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing SetMonitoringMode");
24470  UA_Subscription *sub = UA_Session_getSubscriptionByID(session, request->subscriptionId);
24471  if(!sub) {
24473  return;
24474  }
24475 
24476  if(request->monitoredItemIdsSize == 0) {
24478  return;
24479  }
24480 
24482  if(!response->results) {
24484  return;
24485  }
24486  response->resultsSize = request->monitoredItemIdsSize;
24487 
24488  for(size_t i = 0; i < response->resultsSize; ++i) {
24489  UA_MonitoredItem *mon =
24491  if(!mon) {
24493  continue;
24494  }
24495  if(request->monitoringMode == mon->monitoringMode)
24496  continue;
24497  mon->monitoringMode = request->monitoringMode;
24498  if(mon->monitoringMode == UA_MONITORINGMODE_REPORTING)
24499  MonitoredItem_registerSampleJob(server, mon);
24500  else
24501  MonitoredItem_unregisterSampleJob(server, mon);
24502  }
24503 }
24504 
24505 
24506 void
24507 Service_Publish(UA_Server *server, UA_Session *session,
24508  const UA_PublishRequest *request, UA_UInt32 requestId) {
24509  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing PublishRequest");
24511  /* Return an error if the session has no subscription */
24512  if(LIST_EMPTY(&session->serverSubscriptions)) {
24514  goto send_error;
24515  }
24516 
24517  UA_PublishResponseEntry *entry = UA_malloc(sizeof(UA_PublishResponseEntry));
24518  if(!entry) {
24520  goto send_error;
24521  }
24522  entry->requestId = requestId;
24523 
24524  /* Build the response */
24525  UA_PublishResponse *response = &entry->response;
24526  UA_PublishResponse_init(response);
24528  if(request->subscriptionAcknowledgementsSize > 0) {
24531  if(!response->results) {
24532  UA_free(entry);
24534  goto send_error;
24535  }
24536  response->resultsSize = request->subscriptionAcknowledgementsSize;
24537  }
24538 
24539  /* Delete Acknowledged Subscription Messages */
24540  for(size_t i = 0; i < request->subscriptionAcknowledgementsSize; ++i) {
24542  UA_Subscription *sub = UA_Session_getSubscriptionByID(session, ack->subscriptionId);
24543  if(!sub) {
24545  UA_LOG_DEBUG_SESSION(server->config.logger, session,
24546  "Cannot process acknowledgements subscription %u",
24547  ack->subscriptionId);
24548  continue;
24549  }
24550  /* Remove the acked transmission from the retransmission queue */
24552  }
24553 
24554  /* Queue the publish response */
24555  SIMPLEQ_INSERT_TAIL(&session->responseQueue, entry, listEntry);
24556  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Queued a publication message",
24558 
24559  /* Answer immediately to a late subscription */
24560  UA_Subscription *immediate;
24561  LIST_FOREACH(immediate, &session->serverSubscriptions, listEntry) {
24562  if(immediate->state == UA_SUBSCRIPTIONSTATE_LATE) {
24563  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Subscription %u | "
24564  "Response on a late subscription", immediate->subscriptionID,
24566  UA_Subscription_publishCallback(server, immediate);
24567  break;
24568  }
24569  }
24570  return;
24571 
24572  UA_PublishResponse err_response;
24573  send_error:
24574  UA_PublishResponse_init(&err_response);
24575  err_response.responseHeader.requestHandle = request->requestHeader.requestHandle;
24576  err_response.responseHeader.timestamp = UA_DateTime_now();
24577  err_response.responseHeader.serviceResult = retval;
24578  UA_assert(err_response.responseHeader.requestHandle != 0);
24579  UA_SecureChannel_sendBinaryMessage(session->channel, requestId, &err_response,
24581 }
24582 
24583 void
24584 Service_DeleteSubscriptions(UA_Server *server, UA_Session *session,
24585  const UA_DeleteSubscriptionsRequest *request,
24586  UA_DeleteSubscriptionsResponse *response) {
24587  UA_LOG_DEBUG_SESSION(server->config.logger, session,
24588  "Processing DeleteSubscriptionsRequest");
24589 
24590  if(request->subscriptionIdsSize == 0) {
24592  return;
24593  }
24594 
24595  response->results = UA_malloc(sizeof(UA_StatusCode) * request->subscriptionIdsSize);
24596  if(!response->results) {
24598  return;
24599  }
24600  response->resultsSize = request->subscriptionIdsSize;
24601 
24602  for(size_t i = 0; i < request->subscriptionIdsSize; ++i) {
24603  response->results[i] = UA_Session_deleteSubscription(server, session, request->subscriptionIds[i]);
24604  if(response->results[i] == UA_STATUSCODE_GOOD) {
24605  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Subscription %u | "
24606  "Subscription deleted", request->subscriptionIds[i]);
24607  } else {
24608  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Deleting Subscription with Id "
24609  "%u failed with error code 0x%08x", request->subscriptionIds[i],
24610  response->results[i]);
24611  }
24612  }
24613 
24614  /* Send dangling publish responses in a delayed job if the last subscription
24615  was removed */
24616  if(LIST_FIRST(&session->serverSubscriptions))
24617  return;
24618  UA_NodeId *sessionToken = UA_NodeId_new();
24619  if(!sessionToken)
24620  return;
24621  UA_NodeId_copy(&session->authenticationToken, sessionToken);
24622  UA_Server_delayedCallback(server, (UA_ServerCallback)UA_Subscription_answerPublishRequestsNoSubscription,
24623  sessionToken);
24624 }
24625 
24626 void Service_DeleteMonitoredItems(UA_Server *server, UA_Session *session,
24627  const UA_DeleteMonitoredItemsRequest *request,
24628  UA_DeleteMonitoredItemsResponse *response) {
24629  UA_LOG_DEBUG_SESSION(server->config.logger, session,
24630  "Processing DeleteMonitoredItemsRequest");
24631 
24632  if(request->monitoredItemIdsSize == 0) {
24634  return;
24635  }
24636 
24637  /* Get the subscription */
24638  UA_Subscription *sub = UA_Session_getSubscriptionByID(session, request->subscriptionId);
24639  if(!sub) {
24641  return;
24642  }
24643 
24644  /* Reset the subscription lifetime */
24645  sub->currentLifetimeCount = 0;
24646  response->results = UA_malloc(sizeof(UA_StatusCode) * request->monitoredItemIdsSize);
24647  if(!response->results) {
24649  return;
24650  }
24651  response->resultsSize = request->monitoredItemIdsSize;
24652 
24653  for(size_t i = 0; i < request->monitoredItemIdsSize; ++i)
24654  response->results[i] = UA_Subscription_deleteMonitoredItem(server, sub, request->monitoredItemIds[i]);
24655 }
24656 
24657 void Service_Republish(UA_Server *server, UA_Session *session, const UA_RepublishRequest *request,
24658  UA_RepublishResponse *response) {
24659  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing RepublishRequest");
24660  /* get the subscription */
24661  UA_Subscription *sub = UA_Session_getSubscriptionByID(session, request->subscriptionId);
24662  if (!sub) {
24664  return;
24665  }
24666 
24667  /* Reset the subscription lifetime */
24668  sub->currentLifetimeCount = 0;
24669 
24670  /* Find the notification in the retransmission queue */
24672  TAILQ_FOREACH(entry, &sub->retransmissionQueue, listEntry) {
24673  if(entry->message.sequenceNumber == request->retransmitSequenceNumber)
24674  break;
24675  }
24676  if(entry)
24677  response->responseHeader.serviceResult =
24678  UA_NotificationMessage_copy(&entry->message, &response->notificationMessage);
24679  else
24681 }
24682 
24683 #endif /* UA_ENABLE_SUBSCRIPTIONS */
24684 
24685 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/client/ua_client.c" ***********************************/
24686 
24687 /* This Source Code Form is subject to the terms of the Mozilla Public
24688  * License, v. 2.0. If a copy of the MPL was not distributed with this
24689  * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
24690 
24691 
24692 /*********************/
24693 /* Create and Delete */
24694 /*********************/
24695 
24696 static void UA_Client_init(UA_Client* client, UA_ClientConfig config) {
24697  memset(client, 0, sizeof(UA_Client));
24698  client->channel.connection = &client->connection;
24699  client->config = config;
24700 }
24701 
24702 UA_Client * UA_Client_new(UA_ClientConfig config) {
24703  UA_Client *client = (UA_Client*)UA_calloc(1, sizeof(UA_Client));
24704  if(!client)
24705  return NULL;
24706  UA_Client_init(client, config);
24707  return client;
24708 }
24709 
24710 static void UA_Client_deleteMembers(UA_Client* client) {
24711  UA_Client_disconnect(client);
24714  if(client->endpointUrl.data)
24715  UA_String_deleteMembers(&client->endpointUrl);
24716  UA_UserTokenPolicy_deleteMembers(&client->token);
24717  UA_NodeId_deleteMembers(&client->authenticationToken);
24718  if(client->username.data)
24719  UA_String_deleteMembers(&client->username);
24720  if(client->password.data)
24721  UA_String_deleteMembers(&client->password);
24722 #ifdef UA_ENABLE_SUBSCRIPTIONS
24723  UA_Client_NotificationsAckNumber *n, *tmp;
24724  LIST_FOREACH_SAFE(n, &client->pendingNotificationsAcks, listEntry, tmp) {
24725  LIST_REMOVE(n, listEntry);
24726  UA_free(n);
24727  }
24728  UA_Client_Subscription *sub, *tmps;
24729  LIST_FOREACH_SAFE(sub, &client->subscriptions, listEntry, tmps)
24730  UA_Client_Subscriptions_forceDelete(client, sub); /* force local removal */
24731 #endif
24732 }
24733 
24735  UA_Client_deleteMembers(client);
24736  UA_Client_init(client, client->config);
24737 }
24738 
24740  UA_Client_deleteMembers(client);
24741  UA_free(client);
24742 }
24743 
24744 UA_ClientState UA_Client_getState(UA_Client *client) {
24745  if(!client)
24746  return UA_CLIENTSTATE_ERRORED;
24747  return client->state;
24748 }
24749 
24751  if(!client)
24752  return UA_CONNECTION_CLOSED;
24753  UA_Connection* conn = &client->connection;
24754  return conn->state;
24755 }
24756 
24757 
24758 /*************************/
24759 /* Manage the Connection */
24760 /*************************/
24761 
24762 #define UA_MINMESSAGESIZE 8192
24763 
24764 static UA_StatusCode
24765 HelAckHandshake(UA_Client *client) {
24766  /* Get a buffer */
24767  UA_ByteString message;
24768  UA_Connection *conn = &client->connection;
24769  UA_StatusCode retval = conn->getSendBuffer(conn, UA_MINMESSAGESIZE, &message);
24770  if(retval != UA_STATUSCODE_GOOD)
24771  return retval;
24772 
24773  /* Prepare the HEL message and encode at offset 8 */
24774  UA_TcpHelloMessage hello;
24775  UA_String_copy(&client->endpointUrl, &hello.endpointUrl); /* must be less than 4096 bytes */
24776  hello.maxChunkCount = conn->localConf.maxChunkCount;
24777  hello.maxMessageSize = conn->localConf.maxMessageSize;
24780  hello.sendBufferSize = conn->localConf.sendBufferSize;
24781 
24782  size_t offset = 8;
24783  retval = UA_TcpHelloMessage_encodeBinary(&hello, &message, &offset);
24784  UA_TcpHelloMessage_deleteMembers(&hello);
24785 
24786  /* Encode the message header at offset 0 */
24787  UA_TcpMessageHeader messageHeader;
24789  messageHeader.messageSize = (UA_UInt32)offset;
24790  offset = 0;
24791  retval |= UA_TcpMessageHeader_encodeBinary(&messageHeader, &message, &offset);
24792  if(retval != UA_STATUSCODE_GOOD) {
24793  conn->releaseSendBuffer(conn, &message);
24794  return retval;
24795  }
24796 
24797  /* Send the HEL message */
24798  message.length = messageHeader.messageSize;
24799  retval = conn->send(conn, &message);
24800  if(retval != UA_STATUSCODE_GOOD) {
24801  UA_LOG_INFO(client->config.logger, UA_LOGCATEGORY_NETWORK,
24802  "Sending HEL failed");
24803  return retval;
24804  }
24805  UA_LOG_DEBUG(client->config.logger, UA_LOGCATEGORY_NETWORK,
24806  "Sent HEL message");
24807 
24808  /* Loop until we have a complete chunk */
24810  UA_Boolean realloced = false;
24811  retval = UA_Connection_receiveChunksBlocking(conn, &reply, &realloced,
24812  client->config.timeout);
24813  if(retval != UA_STATUSCODE_GOOD) {
24814  UA_LOG_INFO(client->config.logger, UA_LOGCATEGORY_NETWORK,
24815  "Receiving ACK message failed");
24816  return retval;
24817  }
24818 
24819  /* Decode the message */
24820  offset = 0;
24821  UA_TcpAcknowledgeMessage ackMessage;
24822  retval = UA_TcpMessageHeader_decodeBinary(&reply, &offset, &messageHeader);
24823  retval |= UA_TcpAcknowledgeMessage_decodeBinary(&reply, &offset, &ackMessage);
24824 
24825  /* Free the message buffer */
24826  if(!realloced)
24827  conn->releaseRecvBuffer(conn, &reply);
24828  else
24829  UA_ByteString_deleteMembers(&reply);
24830 
24831  /* Store remote connection settings and adjust local configuration to not
24832  exceed the limits */
24833  if(retval == UA_STATUSCODE_GOOD) {
24834  UA_LOG_DEBUG(client->config.logger, UA_LOGCATEGORY_NETWORK, "Received ACK message");
24835  conn->remoteConf.maxChunkCount = ackMessage.maxChunkCount; /* may be zero -> unlimited */
24836  conn->remoteConf.maxMessageSize = ackMessage.maxMessageSize; /* may be zero -> unlimited */
24837  conn->remoteConf.protocolVersion = ackMessage.protocolVersion;
24838  conn->remoteConf.sendBufferSize = ackMessage.sendBufferSize;
24839  conn->remoteConf.recvBufferSize = ackMessage.receiveBufferSize;
24845  } else {
24846  UA_LOG_INFO(client->config.logger, UA_LOGCATEGORY_NETWORK, "Decoding ACK message failed");
24847  }
24848  UA_TcpAcknowledgeMessage_deleteMembers(&ackMessage);
24849 
24850  return retval;
24851 }
24852 
24853 static UA_StatusCode
24854 SecureChannelHandshake(UA_Client *client, UA_Boolean renew) {
24855  /* Check if sc is still valid */
24856  if(renew && client->nextChannelRenewal - UA_DateTime_nowMonotonic() > 0)
24857  return UA_STATUSCODE_GOOD;
24858 
24859  UA_Connection *conn = &client->connection;
24860  if(conn->state != UA_CONNECTION_ESTABLISHED)
24862 
24863  UA_ByteString message;
24864  UA_StatusCode retval = conn->getSendBuffer(conn, conn->remoteConf.recvBufferSize, &message);
24865  if(retval != UA_STATUSCODE_GOOD)
24866  return retval;
24867 
24868  /* Jump over the messageHeader that will be encoded last */
24869  size_t offset = 12;
24870 
24871  /* Encode the Asymmetric Security Header */
24873  UA_AsymmetricAlgorithmSecurityHeader_init(&asymHeader);
24874  asymHeader.securityPolicyUri = UA_STRING("http://opcfoundation.org/UA/SecurityPolicy#None");
24875  retval = UA_AsymmetricAlgorithmSecurityHeader_encodeBinary(&asymHeader, &message, &offset);
24876 
24877  /* Encode the sequence header */
24878  UA_SequenceHeader seqHeader;
24879  seqHeader.sequenceNumber = ++client->channel.sendSequenceNumber;
24880  seqHeader.requestId = ++client->requestId;
24881  retval |= UA_SequenceHeader_encodeBinary(&seqHeader, &message, &offset);
24882 
24883  /* Encode the NodeId of the OpenSecureChannel Service */
24884  UA_NodeId requestType =
24885  UA_NODEID_NUMERIC(0, UA_TYPES[UA_TYPES_OPENSECURECHANNELREQUEST].binaryEncodingId);
24886  retval |= UA_NodeId_encodeBinary(&requestType, &message, &offset);
24887 
24888  /* Encode the OpenSecureChannelRequest */
24889  UA_OpenSecureChannelRequest opnSecRq;
24890  UA_OpenSecureChannelRequest_init(&opnSecRq);
24893  if(renew) {
24895  UA_LOG_DEBUG(client->config.logger, UA_LOGCATEGORY_SECURECHANNEL,
24896  "Requesting to renew the SecureChannel");
24897  } else {
24899  UA_LOG_DEBUG(client->config.logger, UA_LOGCATEGORY_SECURECHANNEL,
24900  "Requesting to open a SecureChannel");
24901  }
24903  opnSecRq.clientNonce = client->channel.clientNonce;
24904  opnSecRq.requestedLifetime = client->config.secureChannelLifeTime;
24905  retval |= UA_OpenSecureChannelRequest_encodeBinary(&opnSecRq, &message, &offset);
24906 
24907  /* Encode the message header at the beginning */
24908  UA_SecureConversationMessageHeader messageHeader;
24910  messageHeader.messageHeader.messageSize = (UA_UInt32)offset;
24911  if(renew)
24912  messageHeader.secureChannelId = client->channel.securityToken.channelId;
24913  else
24914  messageHeader.secureChannelId = 0;
24915  offset = 0;
24916  retval |= UA_SecureConversationMessageHeader_encodeBinary(&messageHeader, &message, &offset);
24917 
24918  /* Clean up and return if encoding the message failed */
24919  if(retval != UA_STATUSCODE_GOOD) {
24920  client->connection.releaseSendBuffer(&client->connection, &message);
24921  return retval;
24922  }
24923 
24924  /* Send the message */
24925  message.length = messageHeader.messageHeader.messageSize;
24926  retval = conn->send(conn, &message);
24927  if(retval != UA_STATUSCODE_GOOD)
24928  return retval;
24929 
24930  /* Receive the response */
24932  UA_Boolean realloced = false;
24933  retval = UA_Connection_receiveChunksBlocking(conn, &reply, &realloced,
24934  client->config.timeout);
24935  if(retval != UA_STATUSCODE_GOOD) {
24936  UA_LOG_DEBUG(client->config.logger, UA_LOGCATEGORY_SECURECHANNEL,
24937  "Receiving OpenSecureChannelResponse failed");
24938  return retval;
24939  }
24940 
24941  /* Decode the header */
24942  offset = 0;
24943  retval = UA_SecureConversationMessageHeader_decodeBinary(&reply, &offset, &messageHeader);
24944  retval |= UA_AsymmetricAlgorithmSecurityHeader_decodeBinary(&reply, &offset, &asymHeader);
24945  retval |= UA_SequenceHeader_decodeBinary(&reply, &offset, &seqHeader);
24946  retval |= UA_NodeId_decodeBinary(&reply, &offset, &requestType);
24947  UA_NodeId expectedRequest =
24948  UA_NODEID_NUMERIC(0, UA_TYPES[UA_TYPES_OPENSECURECHANNELRESPONSE].binaryEncodingId);
24949  if(retval != UA_STATUSCODE_GOOD || !UA_NodeId_equal(&requestType, &expectedRequest)) {
24950  UA_ByteString_deleteMembers(&reply);
24951  UA_AsymmetricAlgorithmSecurityHeader_deleteMembers(&asymHeader);
24952  UA_NodeId_deleteMembers(&requestType);
24953  UA_LOG_DEBUG(client->config.logger, UA_LOGCATEGORY_CLIENT,
24954  "Reply answers the wrong request. Expected OpenSecureChannelResponse.");
24956  }
24957 
24958  /* Save the sequence number from server */
24959  client->channel.receiveSequenceNumber = seqHeader.sequenceNumber;
24960 
24961  /* Decode the response */
24963  retval = UA_OpenSecureChannelResponse_decodeBinary(&reply, &offset, &response);
24964 
24965  /* Free the message */
24966  if(!realloced)
24967  conn->releaseRecvBuffer(conn, &reply);
24968  else
24969  UA_ByteString_deleteMembers(&reply);
24970 
24971  /* Results in either the StatusCode of decoding or the service */
24972  retval |= response.responseHeader.serviceResult;
24973 
24974  if(retval == UA_STATUSCODE_GOOD) {
24975  /* Response.securityToken.revisedLifetime is UInt32 we need to cast it
24976  * to DateTime=Int64 we take 75% of lifetime to start renewing as
24977  * described in standard */
24980 
24981  /* Replace the old nonce */
24982  UA_ChannelSecurityToken_deleteMembers(&client->channel.securityToken);
24983  UA_ChannelSecurityToken_copy(&response.securityToken, &client->channel.securityToken);
24984  UA_ByteString_deleteMembers(&client->channel.serverNonce);
24985  UA_ByteString_copy(&response.serverNonce, &client->channel.serverNonce);
24986 
24987  if(renew)
24988  UA_LOG_DEBUG(client->config.logger, UA_LOGCATEGORY_SECURECHANNEL,
24989  "SecureChannel renewed");
24990  else
24991  UA_LOG_DEBUG(client->config.logger, UA_LOGCATEGORY_SECURECHANNEL,
24992  "SecureChannel opened");
24993  } else {
24994  if(renew)
24995  UA_LOG_INFO(client->config.logger, UA_LOGCATEGORY_SECURECHANNEL,
24996  "SecureChannel could not be renewed "
24997  "with error code %s", UA_StatusCode_name(retval));
24998  else
24999  UA_LOG_INFO(client->config.logger, UA_LOGCATEGORY_SECURECHANNEL,
25000  "SecureChannel could not be opened "
25001  "with error code %s", UA_StatusCode_name(retval));
25002  }
25003 
25004  /* Clean up */
25005  UA_AsymmetricAlgorithmSecurityHeader_deleteMembers(&asymHeader);
25006  UA_OpenSecureChannelResponse_deleteMembers(&response);
25007  return retval;
25008 }
25009 
25010 static UA_StatusCode
25011 ActivateSession(UA_Client *client) {
25012  UA_ActivateSessionRequest request;
25013  UA_ActivateSessionRequest_init(&request);
25014  request.requestHeader.requestHandle = ++client->requestHandle;
25016  request.requestHeader.timeoutHint = 600000;
25017 
25018  //manual ExtensionObject encoding of the identityToken
25020  UA_AnonymousIdentityToken* identityToken = UA_AnonymousIdentityToken_new();
25021  UA_AnonymousIdentityToken_init(identityToken);
25022  UA_String_copy(&client->token.policyId, &identityToken->policyId);
25025  request.userIdentityToken.content.decoded.data = identityToken;
25026  } else {
25027  UA_UserNameIdentityToken* identityToken = UA_UserNameIdentityToken_new();
25028  UA_UserNameIdentityToken_init(identityToken);
25029  UA_String_copy(&client->token.policyId, &identityToken->policyId);
25030  UA_String_copy(&client->username, &identityToken->userName);
25031  UA_String_copy(&client->password, &identityToken->password);
25034  request.userIdentityToken.content.decoded.data = identityToken;
25035  }
25036 
25037  UA_ActivateSessionResponse response;
25040 
25041  if(response.responseHeader.serviceResult) {
25042  UA_LOG_ERROR(client->config.logger, UA_LOGCATEGORY_CLIENT,
25043  "ActivateSession failed with error code %s",
25044  UA_StatusCode_name(response.responseHeader.serviceResult));
25045  }
25046 
25047  UA_StatusCode retval = response.responseHeader.serviceResult;
25048  UA_ActivateSessionRequest_deleteMembers(&request);
25049  UA_ActivateSessionResponse_deleteMembers(&response);
25050  return retval;
25051 }
25052 
25053 /* Gets a list of endpoints. Memory is allocated for endpointDescription array */
25054 static UA_StatusCode
25055 GetEndpoints(UA_Client *client, size_t* endpointDescriptionsSize,
25056  UA_EndpointDescription** endpointDescriptions) {
25057  UA_GetEndpointsRequest request;
25058  UA_GetEndpointsRequest_init(&request);
25060  request.requestHeader.timeoutHint = 10000;
25061  // assume the endpointurl outlives the service call
25062  request.endpointUrl = client->endpointUrl;
25063 
25064  UA_GetEndpointsResponse response;
25065  UA_GetEndpointsResponse_init(&response);
25068 
25070  UA_StatusCode retval = response.responseHeader.serviceResult;
25071  UA_LOG_ERROR(client->config.logger, UA_LOGCATEGORY_CLIENT,
25072  "GetEndpointRequest failed with error code %s",
25073  UA_StatusCode_name(retval));
25074  UA_GetEndpointsResponse_deleteMembers(&response);
25075  return retval;
25076  }
25077  *endpointDescriptions = response.endpoints;
25078  *endpointDescriptionsSize = response.endpointsSize;
25079  response.endpoints = NULL;
25080  response.endpointsSize = 0;
25081  UA_GetEndpointsResponse_deleteMembers(&response);
25082  return UA_STATUSCODE_GOOD;
25083 }
25084 
25085 static UA_StatusCode
25086 EndpointsHandshake(UA_Client *client) {
25087  UA_EndpointDescription* endpointArray = NULL;
25088  size_t endpointArraySize = 0;
25089  UA_StatusCode retval = GetEndpoints(client, &endpointArraySize, &endpointArray);
25090  if(retval != UA_STATUSCODE_GOOD)
25091  return retval;
25092 
25093  UA_Boolean endpointFound = false;
25094  UA_Boolean tokenFound = false;
25095  UA_String securityNone = UA_STRING("http://opcfoundation.org/UA/SecurityPolicy#None");
25096  UA_String binaryTransport = UA_STRING("http://opcfoundation.org/UA-Profile/"
25097  "Transport/uatcp-uasc-uabinary");
25098 
25099  //TODO: compare endpoint information with client->endpointUri
25100  for(size_t i = 0; i < endpointArraySize; ++i) {
25101  UA_EndpointDescription* endpoint = &endpointArray[i];
25102  /* look out for binary transport endpoints */
25103  /* Note: Siemens returns empty ProfileUrl, we will accept it as binary */
25104  if(endpoint->transportProfileUri.length != 0 &&
25105  !UA_String_equal(&endpoint->transportProfileUri, &binaryTransport))
25106  continue;
25107  /* look out for an endpoint without security */
25108  if(!UA_String_equal(&endpoint->securityPolicyUri, &securityNone))
25109  continue;
25110 
25111  /* endpoint with no security found */
25112  endpointFound = true;
25113 
25114  /* look for a user token policy with an anonymous token */
25115  for(size_t j = 0; j < endpoint->userIdentityTokensSize; ++j) {
25116  UA_UserTokenPolicy* userToken = &endpoint->userIdentityTokens[j];
25117 
25118  /* Usertokens also have a security policy... */
25119  if(userToken->securityPolicyUri.length > 0 &&
25120  !UA_String_equal(&userToken->securityPolicyUri, &securityNone))
25121  continue;
25122 
25123  /* UA_CLIENTAUTHENTICATION_NONE == UA_USERTOKENTYPE_ANONYMOUS
25124  * UA_CLIENTAUTHENTICATION_USERNAME == UA_USERTOKENTYPE_USERNAME
25125  * TODO: Check equivalence for other types when adding the support */
25126  if((int)client->authenticationMethod != (int)userToken->tokenType)
25127  continue;
25128 
25129  /* Endpoint with matching usertokenpolicy found */
25130  tokenFound = true;
25131  UA_UserTokenPolicy_copy(userToken, &client->token);
25132  break;
25133  }
25134  }
25135 
25136  UA_Array_delete(endpointArray, endpointArraySize,
25138 
25139  if(!endpointFound) {
25140  UA_LOG_ERROR(client->config.logger, UA_LOGCATEGORY_CLIENT,
25141  "No suitable endpoint found");
25143  } else if(!tokenFound) {
25144  UA_LOG_ERROR(client->config.logger, UA_LOGCATEGORY_CLIENT,
25145  "No suitable UserTokenPolicy found for the possible endpoints");
25147  }
25148  return retval;
25149 }
25150 
25151 static UA_StatusCode
25152 SessionHandshake(UA_Client *client) {
25153  UA_CreateSessionRequest request;
25154  UA_CreateSessionRequest_init(&request);
25155 
25157  request.requestHeader.timeoutHint = 10000;
25158  UA_ByteString_copy(&client->channel.clientNonce, &request.clientNonce);
25159  request.requestedSessionTimeout = 1200000;
25161  UA_String_copy(&client->endpointUrl, &request.endpointUrl);
25162 
25163  UA_CreateSessionResponse response;
25164  UA_CreateSessionResponse_init(&response);
25167 
25168  UA_NodeId_copy(&response.authenticationToken, &client->authenticationToken);
25169 
25170  UA_StatusCode retval = response.responseHeader.serviceResult;
25171  UA_CreateSessionRequest_deleteMembers(&request);
25172  UA_CreateSessionResponse_deleteMembers(&response);
25173  return retval;
25174 }
25175 
25176 static UA_StatusCode
25177 CloseSession(UA_Client *client) {
25178  UA_CloseSessionRequest request;
25179  UA_CloseSessionRequest_init(&request);
25180 
25182  request.requestHeader.timeoutHint = 10000;
25183  request.deleteSubscriptions = true;
25184  UA_CloseSessionResponse response;
25187 
25188  UA_StatusCode retval = response.responseHeader.serviceResult;
25189  UA_CloseSessionRequest_deleteMembers(&request);
25190  UA_CloseSessionResponse_deleteMembers(&response);
25191  return retval;
25192 }
25193 
25194 static UA_StatusCode
25195 CloseSecureChannel(UA_Client *client) {
25196  UA_SecureChannel *channel = &client->channel;
25198  UA_CloseSecureChannelRequest_init(&request);
25199  request.requestHeader.requestHandle = ++client->requestHandle;
25201  request.requestHeader.timeoutHint = 10000;
25202  UA_NodeId_copy(&client->authenticationToken,
25204 
25207  msgHeader.secureChannelId = channel->securityToken.channelId;
25208 
25210  symHeader.tokenId = channel->securityToken.tokenId;
25211 
25212  UA_SequenceHeader seqHeader;
25213  seqHeader.sequenceNumber = ++channel->sendSequenceNumber;
25214  seqHeader.requestId = ++client->requestId;
25215 
25216  UA_NodeId typeId =
25217  UA_NODEID_NUMERIC(0, UA_TYPES[UA_TYPES_CLOSESECURECHANNELREQUEST].binaryEncodingId);
25218 
25219  UA_ByteString message;
25220  UA_Connection *conn = &client->connection;
25221  UA_StatusCode retval = conn->getSendBuffer(conn, conn->remoteConf.recvBufferSize, &message);
25222  if(retval != UA_STATUSCODE_GOOD){
25223  UA_CloseSecureChannelRequest_deleteMembers(&request);
25224  return retval;
25225  }
25226 
25227  size_t offset = 12;
25228  retval |= UA_SymmetricAlgorithmSecurityHeader_encodeBinary(&symHeader, &message, &offset);
25229  retval |= UA_SequenceHeader_encodeBinary(&seqHeader, &message, &offset);
25230  retval |= UA_NodeId_encodeBinary(&typeId, &message, &offset);
25232  NULL, NULL, &message, &offset);
25233 
25234  msgHeader.messageHeader.messageSize = (UA_UInt32)offset;
25235  offset = 0;
25236  retval |= UA_SecureConversationMessageHeader_encodeBinary(&msgHeader, &message, &offset);
25237 
25238  if(retval == UA_STATUSCODE_GOOD) {
25239  message.length = msgHeader.messageHeader.messageSize;
25240  retval = conn->send(conn, &message);
25241  } else {
25242  conn->releaseSendBuffer(conn, &message);
25243  }
25244  conn->close(conn);
25245  UA_CloseSecureChannelRequest_deleteMembers(&request);
25246  return retval;
25247 }
25248 
25250 UA_Client_getEndpoints(UA_Client *client, const char *serverUrl,
25251  size_t* endpointDescriptionsSize,
25252  UA_EndpointDescription** endpointDescriptions) {
25253  if(client->state == UA_CLIENTSTATE_CONNECTED)
25254  return UA_STATUSCODE_GOOD;
25255  if(client->state == UA_CLIENTSTATE_ERRORED)
25256  UA_Client_reset(client);
25257 
25258 
25260  client->connection =
25261  client->config.connectionFunc(UA_ConnectionConfig_standard, serverUrl,
25262  client->config.logger);
25263  if(client->connection.state != UA_CONNECTION_OPENING) {
25265  goto cleanup;
25266  }
25267 
25268  client->endpointUrl = UA_STRING_ALLOC(serverUrl);
25269  if(!client->endpointUrl.data) {
25271  goto cleanup;
25272  }
25273 
25274  client->connection.localConf = client->config.localConnectionConfig;
25275  retval = HelAckHandshake(client);
25276  if(retval == UA_STATUSCODE_GOOD)
25277  retval = SecureChannelHandshake(client, false);
25278  if(retval == UA_STATUSCODE_GOOD)
25279  retval = GetEndpoints(client, endpointDescriptionsSize, endpointDescriptions);
25280 
25281  /* always cleanup */
25282  cleanup:
25283  UA_Client_disconnect(client);
25284  UA_Client_reset(client);
25285  return retval;
25286 }
25287 
25289 UA_Client_connect_username(UA_Client *client, const char *endpointUrl,
25290  const char *username, const char *password){
25292  client->username = UA_STRING_ALLOC(username);
25293  client->password = UA_STRING_ALLOC(password);
25294  return UA_Client_connect(client, endpointUrl);
25295 }
25296 
25297 
25299 UA_Client_connect(UA_Client *client, const char *endpointUrl) {
25300  if(client->state == UA_CLIENTSTATE_CONNECTED)
25301  return UA_STATUSCODE_GOOD;
25302  if(client->state == UA_CLIENTSTATE_ERRORED) {
25303  UA_Client_reset(client);
25304  }
25305 
25307  client->connection =
25308  client->config.connectionFunc(UA_ConnectionConfig_standard,
25309  endpointUrl, client->config.logger);
25310  if(client->connection.state != UA_CONNECTION_OPENING) {
25312  goto cleanup;
25313  }
25314 
25315  client->endpointUrl = UA_STRING_ALLOC(endpointUrl);
25316  if(!client->endpointUrl.data) {
25318  goto cleanup;
25319  }
25320 
25321  client->connection.localConf = client->config.localConnectionConfig;
25322  retval = HelAckHandshake(client);
25323  if(retval == UA_STATUSCODE_GOOD)
25324  retval = SecureChannelHandshake(client, false);
25325  if(retval == UA_STATUSCODE_GOOD)
25326  retval = EndpointsHandshake(client);
25327  if(retval == UA_STATUSCODE_GOOD)
25328  retval = SessionHandshake(client);
25329  if(retval == UA_STATUSCODE_GOOD)
25330  retval = ActivateSession(client);
25331  if(retval == UA_STATUSCODE_GOOD) {
25333  client->state = UA_CLIENTSTATE_CONNECTED;
25334  } else {
25335  goto cleanup;
25336  }
25337  return retval;
25338 
25339  cleanup:
25340  UA_Client_reset(client);
25341  return retval;
25342 }
25343 
25345  if(client->state == UA_CLIENTSTATE_READY)
25348  /* Is a session established? */
25349  if(client->connection.state == UA_CONNECTION_ESTABLISHED &&
25350  !UA_NodeId_equal(&client->authenticationToken, &UA_NODEID_NULL))
25351  retval = CloseSession(client);
25352  /* Is a secure channel established? */
25354  retval |= CloseSecureChannel(client);
25355  return retval;
25356 }
25357 
25359  UA_StatusCode retval = SecureChannelHandshake(client, true);
25360  if(retval == UA_STATUSCODE_GOOD)
25361  client->state = UA_CLIENTSTATE_CONNECTED;
25362  return retval;
25363 }
25364 
25365 /****************/
25366 /* Raw Services */
25367 /****************/
25368 
25373  void *response;
25375 };
25376 
25377 static void
25378 processServiceResponse(struct ResponseDescription *rd, UA_SecureChannel *channel,
25379  UA_MessageType messageType, UA_UInt32 requestId,
25380  UA_ByteString *message) {
25382  const UA_NodeId expectedNodeId =
25383  UA_NODEID_NUMERIC(0, rd->responseType->binaryEncodingId);
25384  const UA_NodeId serviceFaultNodeId =
25385  UA_NODEID_NUMERIC(0, UA_TYPES[UA_TYPES_SERVICEFAULT].binaryEncodingId);
25386 
25387  UA_ResponseHeader *respHeader = (UA_ResponseHeader*)rd->response;
25388  rd->processed = true;
25389 
25390  if(messageType == UA_MESSAGETYPE_ERR) {
25391  UA_TcpErrorMessage *msg = (UA_TcpErrorMessage*)message;
25392  UA_LOG_ERROR(rd->client->config.logger, UA_LOGCATEGORY_CLIENT,
25393  "Server replied with an error message: %s %.*s",
25394  UA_StatusCode_name(msg->error), msg->reason.length, msg->reason.data);
25395  retval = msg->error;
25396  goto finish;
25397  } else if(messageType != UA_MESSAGETYPE_MSG) {
25398  UA_LOG_ERROR(rd->client->config.logger, UA_LOGCATEGORY_CLIENT,
25399  "Server replied with the wrong message type");
25401  goto finish;
25402  }
25403 
25404  /* Check that the request id matches */
25405  /* Todo: we need to demux async responses since a publish responses may come
25406  at any time */
25407  if(requestId != rd->requestId) {
25408  UA_LOG_ERROR(rd->client->config.logger, UA_LOGCATEGORY_CLIENT,
25409  "Reply answers the wrong requestId. "
25410  "Async services are not yet implemented.");
25412  goto finish;
25413  }
25414 
25415  /* Check that the response type matches */
25416  size_t offset = 0;
25417  UA_NodeId responseId;
25418  retval = UA_NodeId_decodeBinary(message, &offset, &responseId);
25419  if(retval != UA_STATUSCODE_GOOD)
25420  goto finish;
25421  if(!UA_NodeId_equal(&responseId, &expectedNodeId)) {
25422  if(UA_NodeId_equal(&responseId, &serviceFaultNodeId)) {
25423  /* Take the statuscode from the servicefault */
25424  retval = UA_decodeBinary(message, &offset, rd->response,
25426  } else {
25427  UA_LOG_ERROR(rd->client->config.logger, UA_LOGCATEGORY_CLIENT,
25428  "Reply answers the wrong request. Expected ns=%i,i=%i."
25429  "But retrieved ns=%i,i=%i", expectedNodeId.namespaceIndex,
25430  expectedNodeId.identifier.numeric, responseId.namespaceIndex,
25431  responseId.identifier.numeric);
25432  UA_NodeId_deleteMembers(&responseId);
25434  }
25435  goto finish;
25436  }
25437 
25438  /* Decode the response */
25439  retval = UA_decodeBinary(message, &offset, rd->response, rd->responseType);
25440 
25441  finish:
25442  if(retval == UA_STATUSCODE_GOOD) {
25443  UA_LOG_DEBUG(rd->client->config.logger, UA_LOGCATEGORY_CLIENT,
25444  "Received a response of type %i", responseId.identifier.numeric);
25445  } else {
25448  UA_LOG_INFO(rd->client->config.logger, UA_LOGCATEGORY_CLIENT,
25449  "Error receiving the response");
25450  respHeader->serviceResult = retval;
25451  }
25452 }
25453 
25454 void
25455 __UA_Client_Service(UA_Client *client, const void *request, const UA_DataType *requestType,
25456  void *response, const UA_DataType *responseType) {
25457  UA_init(response, responseType);
25458  UA_ResponseHeader *respHeader = (UA_ResponseHeader*)response;
25459 
25460  /* Make sure we have a valid session */
25462  if(retval != UA_STATUSCODE_GOOD) {
25463  respHeader->serviceResult = retval;
25464  client->state = UA_CLIENTSTATE_ERRORED;
25465  return;
25466  }
25467 
25468  /* Adjusting the request header. The const attribute is violated, but we
25469  * only touch the following members: */
25470  UA_RequestHeader *rr = (UA_RequestHeader*)(uintptr_t)request;
25471  rr->authenticationToken = client->authenticationToken; /* cleaned up at the end */
25472  rr->timestamp = UA_DateTime_now();
25473  rr->requestHandle = ++client->requestHandle;
25474 
25475  /* Send the request */
25476  UA_UInt32 requestId = ++client->requestId;
25477  UA_LOG_DEBUG(client->config.logger, UA_LOGCATEGORY_CLIENT,
25478  "Sending a request of type %i", requestType->typeId.identifier.numeric);
25479  retval = UA_SecureChannel_sendBinaryMessage(&client->channel, requestId, rr, requestType);
25480  if(retval != UA_STATUSCODE_GOOD) {
25483  else
25484  respHeader->serviceResult = retval;
25485  client->state = UA_CLIENTSTATE_FAULTED;
25486  UA_NodeId_init(&rr->authenticationToken);
25487  return;
25488  }
25489 
25490  /* Prepare the response and the structure we give into processServiceResponse */
25491  UA_init(response, responseType);
25492  struct ResponseDescription rd = {client, false, requestId, response, responseType};
25493 
25494  /* Retrieve the response */
25495  UA_DateTime maxDate = UA_DateTime_nowMonotonic() + (client->config.timeout * UA_MSEC_TO_DATETIME);
25496  do {
25497  /* Retrieve complete chunks */
25499  UA_Boolean realloced = false;
25501  if(now < maxDate) {
25502  UA_UInt32 timeout = (UA_UInt32)((maxDate - now) / UA_MSEC_TO_DATETIME);
25503  retval = UA_Connection_receiveChunksBlocking(&client->connection, &reply, &realloced, timeout);
25504  } else {
25506  }
25507  if(retval != UA_STATUSCODE_GOOD) {
25508  respHeader->serviceResult = retval;
25509  break;
25510  }
25511  /* ProcessChunks and call processServiceResponse for complete messages */
25512  UA_SecureChannel_processChunks(&client->channel, &reply,
25513  (UA_ProcessMessageCallback*)processServiceResponse, &rd);
25514  /* Free the received buffer */
25515  if(!realloced)
25516  client->connection.releaseRecvBuffer(&client->connection, &reply);
25517  else
25518  UA_ByteString_deleteMembers(&reply);
25519  } while(!rd.processed);
25520 
25521  /* Clean up the authentication token */
25522  UA_NodeId_init(&rr->authenticationToken);
25523 }
25524 
25525 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/client/ua_client_highlevel.c" ***********************************/
25526 
25527 /* This Source Code Form is subject to the terms of the Mozilla Public
25528 * License, v. 2.0. If a copy of the MPL was not distributed with this
25529 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
25530 
25531 
25534  UA_UInt16 *namespaceIndex) {
25535  UA_ReadRequest request;
25536  UA_ReadRequest_init(&request);
25538  UA_ReadValueId_init(&id);
25539  id.attributeId = UA_ATTRIBUTEID_VALUE;
25540  id.nodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_NAMESPACEARRAY);
25541  request.nodesToRead = &id;
25542  request.nodesToReadSize = 1;
25543 
25544  UA_ReadResponse response = UA_Client_Service_read(client, request);
25545 
25548  retval = response.responseHeader.serviceResult;
25549  else if(response.resultsSize != 1 || !response.results[0].hasValue)
25551  else if(response.results[0].value.type != &UA_TYPES[UA_TYPES_STRING])
25553 
25554  if(retval != UA_STATUSCODE_GOOD) {
25555  UA_ReadResponse_deleteMembers(&response);
25556  return retval;
25557  }
25558 
25559  retval = UA_STATUSCODE_BADNOTFOUND;
25560  UA_String *ns = response.results[0].value.data;
25561  for(size_t i = 0; i < response.results[0].value.arrayLength; ++i){
25562  if(UA_String_equal(namespaceUri, &ns[i])) {
25563  *namespaceIndex = (UA_UInt16)i;
25564  retval = UA_STATUSCODE_GOOD;
25565  break;
25566  }
25567  }
25568 
25569  UA_ReadResponse_deleteMembers(&response);
25570  return retval;
25571 }
25572 
25575  UA_NodeIteratorCallback callback, void *handle) {
25576  UA_BrowseRequest bReq;
25577  UA_BrowseRequest_init(&bReq);
25579  bReq.nodesToBrowse = UA_BrowseDescription_new();
25580  bReq.nodesToBrowseSize = 1;
25581  UA_NodeId_copy(&parentNodeId, &bReq.nodesToBrowse[0].nodeId);
25582  bReq.nodesToBrowse[0].resultMask = UA_BROWSERESULTMASK_ALL; //return everything
25584 
25585  UA_BrowseResponse bResp = UA_Client_Service_browse(client, bReq);
25586 
25589  for (size_t i = 0; i < bResp.resultsSize; ++i) {
25590  for (size_t j = 0; j < bResp.results[i].referencesSize; ++j) {
25591  UA_ReferenceDescription *ref = &(bResp.results[i].references[j]);
25592  retval |= callback(ref->nodeId.nodeId, !ref->isForward,
25593  ref->referenceTypeId, handle);
25594  }
25595  }
25596  }
25597  else
25598  retval = bResp.responseHeader.serviceResult;
25599 
25600 
25601  UA_BrowseRequest_deleteMembers(&bReq);
25602  UA_BrowseResponse_deleteMembers(&bResp);
25603 
25604  return retval;
25605 }
25606 
25607 /*******************/
25608 /* Node Management */
25609 /*******************/
25610 
25612 UA_Client_addReference(UA_Client *client, const UA_NodeId sourceNodeId,
25613  const UA_NodeId referenceTypeId, UA_Boolean isForward,
25614  const UA_String targetServerUri,
25615  const UA_ExpandedNodeId targetNodeId,
25616  UA_NodeClass targetNodeClass) {
25617  UA_AddReferencesItem item;
25618  UA_AddReferencesItem_init(&item);
25619  item.sourceNodeId = sourceNodeId;
25620  item.referenceTypeId = referenceTypeId;
25621  item.isForward = isForward;
25622  item.targetServerUri = targetServerUri;
25623  item.targetNodeId = targetNodeId;
25624  item.targetNodeClass = targetNodeClass;
25625  UA_AddReferencesRequest request;
25626  UA_AddReferencesRequest_init(&request);
25627  request.referencesToAdd = &item;
25628  request.referencesToAddSize = 1;
25629  UA_AddReferencesResponse response = UA_Client_Service_addReferences(client, request);
25630  UA_StatusCode retval = response.responseHeader.serviceResult;
25631  if(retval != UA_STATUSCODE_GOOD) {
25632  UA_AddReferencesResponse_deleteMembers(&response);
25633  return retval;
25634  }
25635  if(response.resultsSize != 1) {
25636  UA_AddReferencesResponse_deleteMembers(&response);
25638  }
25639  retval = response.results[0];
25640  UA_AddReferencesResponse_deleteMembers(&response);
25641  return retval;
25642 }
25643 
25645 UA_Client_deleteReference(UA_Client *client, const UA_NodeId sourceNodeId,
25646  const UA_NodeId referenceTypeId, UA_Boolean isForward,
25647  const UA_ExpandedNodeId targetNodeId,
25648  UA_Boolean deleteBidirectional) {
25650  UA_DeleteReferencesItem_init(&item);
25651  item.sourceNodeId = sourceNodeId;
25652  item.referenceTypeId = referenceTypeId;
25653  item.isForward = isForward;
25654  item.targetNodeId = targetNodeId;
25655  item.deleteBidirectional = deleteBidirectional;
25657  UA_DeleteReferencesRequest_init(&request);
25658  request.referencesToDelete = &item;
25659  request.referencesToDeleteSize = 1;
25660  UA_DeleteReferencesResponse response = UA_Client_Service_deleteReferences(client, request);
25661  UA_StatusCode retval = response.responseHeader.serviceResult;
25662  if(retval != UA_STATUSCODE_GOOD) {
25663  UA_DeleteReferencesResponse_deleteMembers(&response);
25664  return retval;
25665  }
25666  if(response.resultsSize != 1) {
25667  UA_DeleteReferencesResponse_deleteMembers(&response);
25669  }
25670  retval = response.results[0];
25671  UA_DeleteReferencesResponse_deleteMembers(&response);
25672  return retval;
25673 }
25674 
25677  UA_Boolean deleteTargetReferences) {
25678  UA_DeleteNodesItem item;
25679  UA_DeleteNodesItem_init(&item);
25680  item.nodeId = nodeId;
25681  item.deleteTargetReferences = deleteTargetReferences;
25682  UA_DeleteNodesRequest request;
25683  UA_DeleteNodesRequest_init(&request);
25684  request.nodesToDelete = &item;
25685  request.nodesToDeleteSize = 1;
25686  UA_DeleteNodesResponse response = UA_Client_Service_deleteNodes(client, request);
25687  UA_StatusCode retval = response.responseHeader.serviceResult;
25688  if(retval != UA_STATUSCODE_GOOD) {
25689  UA_DeleteNodesResponse_deleteMembers(&response);
25690  return retval;
25691  }
25692  if(response.resultsSize != 1) {
25693  UA_DeleteNodesResponse_deleteMembers(&response);
25695  }
25696  retval = response.results[0];
25697  UA_DeleteNodesResponse_deleteMembers(&response);
25698  return retval;
25699 }
25700 
25702 __UA_Client_addNode(UA_Client *client, const UA_NodeClass nodeClass,
25703  const UA_NodeId requestedNewNodeId, const UA_NodeId parentNodeId,
25704  const UA_NodeId referenceTypeId, const UA_QualifiedName browseName,
25705  const UA_NodeId typeDefinition, const UA_NodeAttributes *attr,
25706  const UA_DataType *attributeType, UA_NodeId *outNewNodeId) {
25708  UA_AddNodesRequest request;
25709  UA_AddNodesRequest_init(&request);
25710  UA_AddNodesItem item;
25711  UA_AddNodesItem_init(&item);
25712  item.parentNodeId.nodeId = parentNodeId;
25713  item.referenceTypeId = referenceTypeId;
25714  item.requestedNewNodeId.nodeId = requestedNewNodeId;
25715  item.browseName = browseName;
25716  item.nodeClass = nodeClass;
25717  item.typeDefinition.nodeId = typeDefinition;
25719  item.nodeAttributes.content.decoded.type = attributeType;
25720  item.nodeAttributes.content.decoded.data = (void*)(uintptr_t)attr; // hack. is not written into.
25721  request.nodesToAdd = &item;
25722  request.nodesToAddSize = 1;
25723  UA_AddNodesResponse response = UA_Client_Service_addNodes(client, request);
25725  retval = response.responseHeader.serviceResult;
25726  UA_AddNodesResponse_deleteMembers(&response);
25727  return retval;
25728  }
25729  if(response.resultsSize != 1) {
25730  UA_AddNodesResponse_deleteMembers(&response);
25732  }
25733  if(outNewNodeId && response.results[0].statusCode == UA_STATUSCODE_GOOD) {
25734  *outNewNodeId = response.results[0].addedNodeId;
25735  UA_NodeId_init(&response.results[0].addedNodeId);
25736  }
25737  retval = response.results[0].statusCode;
25738  UA_AddNodesResponse_deleteMembers(&response);
25739  return retval;
25740 }
25741 
25742 /********/
25743 /* Call */
25744 /********/
25745 
25746 #ifdef UA_ENABLE_METHODCALLS
25747 
25749 UA_Client_call(UA_Client *client, const UA_NodeId objectId,
25750  const UA_NodeId methodId, size_t inputSize,
25751  const UA_Variant *input, size_t *outputSize,
25752  UA_Variant **output) {
25753  /* Set up the request */
25754  UA_CallRequest request;
25755  UA_CallRequest_init(&request);
25756  UA_CallMethodRequest item;
25757  UA_CallMethodRequest_init(&item);
25758  item.methodId = methodId;
25759  item.objectId = objectId;
25760  item.inputArguments = (void*)(uintptr_t)input; // cast const...
25761  item.inputArgumentsSize = inputSize;
25762  request.methodsToCall = &item;
25763  request.methodsToCallSize = 1;
25764 
25765  /* Call the service */
25766  UA_CallResponse response = UA_Client_Service_call(client, request);
25767  UA_StatusCode retval = response.responseHeader.serviceResult;
25768  if(retval == UA_STATUSCODE_GOOD) {
25769  if(response.resultsSize == 1)
25770  retval = response.results[0].statusCode;
25771  else
25773  }
25774  if(retval != UA_STATUSCODE_GOOD) {
25775  UA_CallResponse_deleteMembers(&response);
25776  return retval;
25777  }
25778 
25779  /* Move the output arguments */
25780  if(output != NULL && outputSize != NULL) {
25781  *output = response.results[0].outputArguments;
25782  *outputSize = response.results[0].outputArgumentsSize;
25783  response.results[0].outputArguments = NULL;
25784  response.results[0].outputArgumentsSize = 0;
25785  }
25786  UA_CallResponse_deleteMembers(&response);
25787  return retval;
25788 }
25789 
25790 #endif
25791 
25792 /********************/
25793 /* Write Attributes */
25794 /********************/
25795 
25798  UA_AttributeId attributeId, const void *in,
25799  const UA_DataType *inDataType) {
25800  if(!in)
25802 
25803  UA_WriteValue wValue;
25804  UA_WriteValue_init(&wValue);
25805  wValue.nodeId = *nodeId;
25806  wValue.attributeId = attributeId;
25807  if(attributeId == UA_ATTRIBUTEID_VALUE)
25808  wValue.value.value = *(const UA_Variant*)in;
25809  else
25810  /* hack. is never written into. */
25811  UA_Variant_setScalar(&wValue.value.value, (void*)(uintptr_t)in, inDataType);
25812  wValue.value.hasValue = true;
25813  UA_WriteRequest wReq;
25814  UA_WriteRequest_init(&wReq);
25815  wReq.nodesToWrite = &wValue;
25816  wReq.nodesToWriteSize = 1;
25817 
25818  UA_WriteResponse wResp = UA_Client_Service_write(client, wReq);
25819 
25821  if(retval == UA_STATUSCODE_GOOD) {
25822  if(wResp.resultsSize == 1)
25823  retval = wResp.results[0];
25824  else
25826  }
25827 
25828  UA_WriteResponse_deleteMembers(&wResp);
25829  return retval;
25830 }
25831 
25834  const UA_UInt32 *newArrayDimensions,
25835  size_t newArrayDimensionsSize) {
25836  if(!newArrayDimensions)
25838 
25839  UA_WriteValue wValue;
25840  UA_WriteValue_init(&wValue);
25841  wValue.nodeId = nodeId;
25843  UA_Variant_setArray(&wValue.value.value, (void*)(uintptr_t)newArrayDimensions,
25844  newArrayDimensionsSize, &UA_TYPES[UA_TYPES_UINT32]);
25845  wValue.value.hasValue = true;
25846  UA_WriteRequest wReq;
25847  UA_WriteRequest_init(&wReq);
25848  wReq.nodesToWrite = &wValue;
25849  wReq.nodesToWriteSize = 1;
25850 
25851  UA_WriteResponse wResp = UA_Client_Service_write(client, wReq);
25852 
25854  if(retval == UA_STATUSCODE_GOOD) {
25855  if(wResp.resultsSize == 1)
25856  retval = wResp.results[0];
25857  else
25859  }
25860  UA_WriteResponse_deleteMembers(&wResp);
25861  return retval;
25862 }
25863 
25864 /*******************/
25865 /* Read Attributes */
25866 /*******************/
25867 
25870  UA_AttributeId attributeId, void *out,
25871  const UA_DataType *outDataType) {
25872  UA_ReadValueId item;
25873  UA_ReadValueId_init(&item);
25874  item.nodeId = *nodeId;
25875  item.attributeId = attributeId;
25876  UA_ReadRequest request;
25877  UA_ReadRequest_init(&request);
25878  request.nodesToRead = &item;
25879  request.nodesToReadSize = 1;
25880  UA_ReadResponse response = UA_Client_Service_read(client, request);
25881  UA_StatusCode retval = response.responseHeader.serviceResult;
25882  if(retval == UA_STATUSCODE_GOOD) {
25883  if(response.resultsSize == 1)
25884  retval = response.results[0].status;
25885  else
25887  }
25888  if(retval != UA_STATUSCODE_GOOD) {
25889  UA_ReadResponse_deleteMembers(&response);
25890  return retval;
25891  }
25892 
25893  /* Set the StatusCode */
25894  UA_DataValue *res = response.results;
25895  if(res->hasStatus)
25896  retval = res->status;
25897 
25898  /* Return early of no value is given */
25899  if(!res->hasValue) {
25900  if(retval == UA_STATUSCODE_GOOD)
25902  UA_ReadResponse_deleteMembers(&response);
25903  return retval;
25904  }
25905 
25906  /* Copy value into out */
25907  if(attributeId == UA_ATTRIBUTEID_VALUE) {
25908  memcpy(out, &res->value, sizeof(UA_Variant));
25909  UA_Variant_init(&res->value);
25910  } else if(attributeId == UA_ATTRIBUTEID_NODECLASS) {
25911  memcpy(out, (UA_NodeClass*)res->value.data, sizeof(UA_NodeClass));
25912  } else if(UA_Variant_isScalar(&res->value) &&
25913  res->value.type == outDataType) {
25914  memcpy(out, res->value.data, res->value.type->memSize);
25915  UA_free(res->value.data);
25916  res->value.data = NULL;
25917  } else {
25919  }
25920 
25921  UA_ReadResponse_deleteMembers(&response);
25922  return retval;
25923 }
25924 
25927  UA_UInt32 **outArrayDimensions,
25928  size_t *outArrayDimensionsSize) {
25929  UA_ReadValueId item;
25930  UA_ReadValueId_init(&item);
25931  item.nodeId = nodeId;
25933  UA_ReadRequest request;
25934  UA_ReadRequest_init(&request);
25935  request.nodesToRead = &item;
25936  request.nodesToReadSize = 1;
25937  UA_ReadResponse response = UA_Client_Service_read(client, request);
25938  UA_StatusCode retval = response.responseHeader.serviceResult;
25939  if(retval == UA_STATUSCODE_GOOD) {
25940  if(response.resultsSize == 1)
25941  retval = response.results[0].status;
25942  else
25944  }
25945  if(retval != UA_STATUSCODE_GOOD)
25946  goto cleanup;
25947 
25948  UA_DataValue *res = response.results;
25949  if(res->hasStatus != UA_STATUSCODE_GOOD)
25950  retval = res->hasStatus;
25951  else if(!res->hasValue || UA_Variant_isScalar(&res->value))
25953  if(retval != UA_STATUSCODE_GOOD)
25954  goto cleanup;
25955 
25956  if(UA_Variant_isScalar(&res->value) ||
25957  res->value.type != &UA_TYPES[UA_TYPES_UINT32]) {
25959  goto cleanup;
25960  }
25961 
25962  /* Move data out of the results structure instead of copying */
25963  *outArrayDimensions = res->value.data;
25964  *outArrayDimensionsSize = res->value.arrayLength;
25965  res->value.data = NULL;
25966  res->value.arrayLength = 0;
25967 
25968  cleanup:
25969  UA_ReadResponse_deleteMembers(&response);
25970  return retval;
25971 
25972 }
25973 
25974 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/client/ua_client_highlevel_subscriptions.c" ***********************************/
25975 
25976 /* This Source Code Form is subject to the terms of the Mozilla Public
25977 * License, v. 2.0. If a copy of the MPL was not distributed with this
25978 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
25979 
25980 
25981 #ifdef UA_ENABLE_SUBSCRIPTIONS /* conditional compilation */
25982 
25984 UA_Client_Subscriptions_new(UA_Client *client, UA_SubscriptionSettings settings,
25985  UA_UInt32 *newSubscriptionId) {
25987  UA_CreateSubscriptionRequest_init(&request);
25988  request.requestedPublishingInterval = settings.requestedPublishingInterval;
25989  request.requestedLifetimeCount = settings.requestedLifetimeCount;
25990  request.requestedMaxKeepAliveCount = settings.requestedMaxKeepAliveCount;
25991  request.maxNotificationsPerPublish = settings.maxNotificationsPerPublish;
25992  request.publishingEnabled = settings.publishingEnabled;
25993  request.priority = settings.priority;
25994 
25995  UA_CreateSubscriptionResponse response = UA_Client_Service_createSubscription(client, request);
25996  UA_StatusCode retval = response.responseHeader.serviceResult;
25997  if(retval != UA_STATUSCODE_GOOD)
25998  goto cleanup;
25999 
26000  UA_Client_Subscription *newSub = UA_malloc(sizeof(UA_Client_Subscription));
26001  if(!newSub) {
26003  goto cleanup;
26004  }
26005 
26006  LIST_INIT(&newSub->monitoredItems);
26007  newSub->lifeTime = response.revisedLifetimeCount;
26008  newSub->keepAliveCount = response.revisedMaxKeepAliveCount;
26009  newSub->publishingInterval = response.revisedPublishingInterval;
26010  newSub->subscriptionID = response.subscriptionId;
26011  newSub->notificationsPerPublish = request.maxNotificationsPerPublish;
26012  newSub->priority = request.priority;
26013  LIST_INSERT_HEAD(&client->subscriptions, newSub, listEntry);
26014 
26015  if(newSubscriptionId)
26016  *newSubscriptionId = newSub->subscriptionID;
26017 
26018  cleanup:
26019  UA_CreateSubscriptionResponse_deleteMembers(&response);
26020  return retval;
26021 }
26022 
26023 /* remove the subscription remotely */
26025 UA_Client_Subscriptions_remove(UA_Client *client, UA_UInt32 subscriptionId) {
26026  UA_Client_Subscription *sub;
26027  LIST_FOREACH(sub, &client->subscriptions, listEntry) {
26028  if(sub->subscriptionID == subscriptionId)
26029  break;
26030  }
26031  if(!sub)
26033 
26035  UA_Client_MonitoredItem *mon, *tmpmon;
26036  LIST_FOREACH_SAFE(mon, &sub->monitoredItems, listEntry, tmpmon) {
26037  retval =
26038  UA_Client_Subscriptions_removeMonitoredItem(client, sub->subscriptionID,
26039  mon->monitoredItemId);
26040  if(retval != UA_STATUSCODE_GOOD)
26041  return retval;
26042  }
26043 
26044  /* remove the subscription remotely */
26046  UA_DeleteSubscriptionsRequest_init(&request);
26047  request.subscriptionIdsSize = 1;
26048  request.subscriptionIds = &sub->subscriptionID;
26049  UA_DeleteSubscriptionsResponse response = UA_Client_Service_deleteSubscriptions(client, request);
26050  retval = response.responseHeader.serviceResult;
26051  if(retval == UA_STATUSCODE_GOOD && response.resultsSize > 0)
26052  retval = response.results[0];
26053  UA_DeleteSubscriptionsResponse_deleteMembers(&response);
26054 
26055  if(retval != UA_STATUSCODE_GOOD && retval != UA_STATUSCODE_BADSUBSCRIPTIONIDINVALID) {
26056  UA_LOG_INFO(client->config.logger, UA_LOGCATEGORY_CLIENT,
26057  "Could not remove subscription %u with error code %s",
26058  sub->subscriptionID, UA_StatusCode_name(retval));
26059  return retval;
26060  }
26061 
26062  UA_Client_Subscriptions_forceDelete(client, sub);
26063  return UA_STATUSCODE_GOOD;
26064 }
26065 
26066 void
26067 UA_Client_Subscriptions_forceDelete(UA_Client *client,
26068  UA_Client_Subscription *sub) {
26069  UA_Client_MonitoredItem *mon, *mon_tmp;
26070  LIST_FOREACH_SAFE(mon, &sub->monitoredItems, listEntry, mon_tmp) {
26071  UA_NodeId_deleteMembers(&mon->monitoredNodeId);
26072  LIST_REMOVE(mon, listEntry);
26073  UA_free(mon);
26074  }
26075  LIST_REMOVE(sub, listEntry);
26076  UA_free(sub);
26077 }
26078 
26080 UA_Client_Subscriptions_addMonitoredItem(UA_Client *client, UA_UInt32 subscriptionId,
26081  UA_NodeId nodeId, UA_UInt32 attributeID,
26082  UA_MonitoredItemHandlingFunction hf,
26083  void *hfContext, UA_UInt32 *newMonitoredItemId) {
26084  UA_Client_Subscription *sub;
26085  LIST_FOREACH(sub, &client->subscriptions, listEntry) {
26086  if(sub->subscriptionID == subscriptionId)
26087  break;
26088  }
26089  if(!sub)
26091 
26092  /* Create the handler */
26093  UA_Client_MonitoredItem *newMon = UA_malloc(sizeof(UA_Client_MonitoredItem));
26094  if(!newMon)
26096 
26097  /* Send the request */
26099  UA_CreateMonitoredItemsRequest_init(&request);
26100  request.subscriptionId = subscriptionId;
26102  UA_MonitoredItemCreateRequest_init(&item);
26103  item.itemToMonitor.nodeId = nodeId;
26104  item.itemToMonitor.attributeId = attributeID;
26106  item.requestedParameters.clientHandle = ++(client->monitoredItemHandles);
26107  item.requestedParameters.samplingInterval = sub->publishingInterval;
26108  item.requestedParameters.discardOldest = true;
26109  item.requestedParameters.queueSize = 1;
26110  request.itemsToCreate = &item;
26111  request.itemsToCreateSize = 1;
26112  UA_CreateMonitoredItemsResponse response = UA_Client_Service_createMonitoredItems(client, request);
26113 
26114  // slight misuse of retval here to check if the addition was successfull.
26115  UA_StatusCode retval = response.responseHeader.serviceResult;
26116  if(retval == UA_STATUSCODE_GOOD) {
26117  if(response.resultsSize == 1)
26118  retval = response.results[0].statusCode;
26119  else
26121  }
26122  if(retval != UA_STATUSCODE_GOOD) {
26123  UA_free(newMon);
26124  UA_CreateMonitoredItemsResponse_deleteMembers(&response);
26125  return retval;
26126  }
26127 
26128  /* Set the handler */
26129  newMon->monitoringMode = UA_MONITORINGMODE_REPORTING;
26130  UA_NodeId_copy(&nodeId, &newMon->monitoredNodeId);
26131  newMon->attributeID = attributeID;
26132  newMon->clientHandle = client->monitoredItemHandles;
26133  newMon->samplingInterval = sub->publishingInterval;
26134  newMon->queueSize = 1;
26135  newMon->discardOldest = true;
26136  newMon->handler = hf;
26137  newMon->handlerContext = hfContext;
26138  newMon->monitoredItemId = response.results[0].monitoredItemId;
26139  LIST_INSERT_HEAD(&sub->monitoredItems, newMon, listEntry);
26140  *newMonitoredItemId = newMon->monitoredItemId;
26141 
26142  UA_LOG_DEBUG(client->config.logger, UA_LOGCATEGORY_CLIENT,
26143  "Created a monitored item with client handle %u",
26144  client->monitoredItemHandles);
26145 
26146  UA_CreateMonitoredItemsResponse_deleteMembers(&response);
26147  return UA_STATUSCODE_GOOD;
26148 }
26149 
26151 UA_Client_Subscriptions_removeMonitoredItem(UA_Client *client, UA_UInt32 subscriptionId,
26152  UA_UInt32 monitoredItemId) {
26153  UA_Client_Subscription *sub;
26154  LIST_FOREACH(sub, &client->subscriptions, listEntry) {
26155  if(sub->subscriptionID == subscriptionId)
26156  break;
26157  }
26158  if(!sub)
26160 
26161  UA_Client_MonitoredItem *mon;
26162  LIST_FOREACH(mon, &sub->monitoredItems, listEntry) {
26163  if(mon->monitoredItemId == monitoredItemId)
26164  break;
26165  }
26166  if(!mon)
26168 
26169  /* remove the monitoreditem remotely */
26171  UA_DeleteMonitoredItemsRequest_init(&request);
26172  request.subscriptionId = sub->subscriptionID;
26173  request.monitoredItemIdsSize = 1;
26174  request.monitoredItemIds = &mon->monitoredItemId;
26175  UA_DeleteMonitoredItemsResponse response = UA_Client_Service_deleteMonitoredItems(client, request);
26176 
26177  UA_StatusCode retval = response.responseHeader.serviceResult;
26178  if(retval == UA_STATUSCODE_GOOD && response.resultsSize > 1)
26179  retval = response.results[0];
26180  UA_DeleteMonitoredItemsResponse_deleteMembers(&response);
26181  if(retval != UA_STATUSCODE_GOOD &&
26183  UA_LOG_INFO(client->config.logger, UA_LOGCATEGORY_CLIENT,
26184  "Could not remove monitoreditem %u with error code %s",
26185  monitoredItemId, UA_StatusCode_name(retval));
26186  return retval;
26187  }
26188 
26189  LIST_REMOVE(mon, listEntry);
26190  UA_NodeId_deleteMembers(&mon->monitoredNodeId);
26191  UA_free(mon);
26192  return UA_STATUSCODE_GOOD;
26193 }
26194 
26195 static void
26196 UA_Client_processPublishResponse(UA_Client *client, UA_PublishRequest *request,
26197  UA_PublishResponse *response) {
26199  return;
26200 
26201  /* Find the subscription */
26202  UA_Client_Subscription *sub;
26203  LIST_FOREACH(sub, &client->subscriptions, listEntry) {
26204  if(sub->subscriptionID == response->subscriptionId)
26205  break;
26206  }
26207  if(!sub)
26208  return;
26209 
26210  UA_LOG_DEBUG(client->config.logger, UA_LOGCATEGORY_CLIENT,
26211  "Processing a publish response on subscription %u with %u notifications",
26212  sub->subscriptionID, response->notificationMessage.notificationDataSize);
26213 
26214  /* Check if the server has acknowledged any of the sent ACKs */
26215  for(size_t i = 0; i < response->resultsSize && i < request->subscriptionAcknowledgementsSize; ++i) {
26216  /* remove also acks that are unknown to the server */
26217  if(response->results[i] != UA_STATUSCODE_GOOD &&
26219  continue;
26220 
26221  /* Remove the ack from the list */
26223  UA_Client_NotificationsAckNumber *ack;
26224  LIST_FOREACH(ack, &client->pendingNotificationsAcks, listEntry) {
26225  if(ack->subAck.subscriptionId == orig_ack->subscriptionId &&
26226  ack->subAck.sequenceNumber == orig_ack->sequenceNumber) {
26227  LIST_REMOVE(ack, listEntry);
26228  UA_free(ack);
26229  UA_assert(ack != LIST_FIRST(&client->pendingNotificationsAcks));
26230  break;
26231  }
26232  }
26233  }
26234 
26235  /* Process the notification messages */
26236  UA_NotificationMessage *msg = &response->notificationMessage;
26237  for(size_t k = 0; k < msg->notificationDataSize; ++k) {
26239  continue;
26240 
26241  /* Currently only dataChangeNotifications are supported */
26243  continue;
26244 
26245  UA_DataChangeNotification *dataChangeNotification = msg->notificationData[k].content.decoded.data;
26246  for(size_t j = 0; j < dataChangeNotification->monitoredItemsSize; ++j) {
26247  UA_MonitoredItemNotification *mitemNot = &dataChangeNotification->monitoredItems[j];
26248  UA_Client_MonitoredItem *mon;
26249  LIST_FOREACH(mon, &sub->monitoredItems, listEntry) {
26250  if(mon->clientHandle == mitemNot->clientHandle) {
26251  mon->handler(mon->monitoredItemId, &mitemNot->value, mon->handlerContext);
26252  break;
26253  }
26254  }
26255  if(!mon)
26256  UA_LOG_DEBUG(client->config.logger, UA_LOGCATEGORY_CLIENT,
26257  "Could not process a notification with clienthandle %u on subscription %u",
26258  mitemNot->clientHandle, sub->subscriptionID);
26259  }
26260  }
26261 
26262  /* Add to the list of pending acks */
26263  UA_Client_NotificationsAckNumber *tmpAck = UA_malloc(sizeof(UA_Client_NotificationsAckNumber));
26264  if(!tmpAck) {
26265  UA_LOG_WARNING(client->config.logger, UA_LOGCATEGORY_CLIENT,
26266  "Not enough memory to store the acknowledgement for a "
26267  "publish message on subscription %u", sub->subscriptionID);
26268  return;
26269  }
26270  tmpAck->subAck.sequenceNumber = msg->sequenceNumber;
26271  tmpAck->subAck.subscriptionId = sub->subscriptionID;
26272  LIST_INSERT_HEAD(&client->pendingNotificationsAcks, tmpAck, listEntry);
26273 }
26274 
26276 UA_Client_Subscriptions_manuallySendPublishRequest(UA_Client *client) {
26277  if (client->state == UA_CLIENTSTATE_ERRORED)
26279 
26280  UA_Boolean moreNotifications = true;
26281  while(moreNotifications) {
26282  UA_PublishRequest request;
26283  UA_PublishRequest_init(&request);
26285 
26286  UA_Client_NotificationsAckNumber *ack;
26287  LIST_FOREACH(ack, &client->pendingNotificationsAcks, listEntry)
26289  if(request.subscriptionAcknowledgementsSize > 0) {
26292  if(!request.subscriptionAcknowledgements)
26293  return UA_STATUSCODE_GOOD;
26294  }
26295 
26296  int i = 0;
26297  LIST_FOREACH(ack, &client->pendingNotificationsAcks, listEntry) {
26298  request.subscriptionAcknowledgements[i].sequenceNumber = ack->subAck.sequenceNumber;
26299  request.subscriptionAcknowledgements[i].subscriptionId = ack->subAck.subscriptionId;
26300  ++i;
26301  }
26302 
26303  UA_PublishResponse response = UA_Client_Service_publish(client, request);
26304  UA_Client_processPublishResponse(client, &request, &response);
26305  moreNotifications = response.moreNotifications;
26306 
26307  UA_PublishResponse_deleteMembers(&response);
26308  UA_PublishRequest_deleteMembers(&request);
26309  }
26310  return UA_STATUSCODE_GOOD;
26311 }
26312 
26313 #endif /* UA_ENABLE_SUBSCRIPTIONS */
26314 
26315 /*********************************** amalgamated original file "/home/iosb/sw/open62541/deps/libc_time.c" ***********************************/
26316 
26317 /*
26318  * Originally released by the musl project (http://www.musl-libc.org/) under the
26319  * MIT license. Taken from the file /src/time/__secs_to_tm.c
26320  */
26321 
26322 
26323 /* 2000-03-01 (mod 400 year, immediately after feb29 */
26324 #define LEAPOCH (946684800LL + 86400*(31+29))
26325 
26326 #define DAYS_PER_400Y (365*400 + 97)
26327 #define DAYS_PER_100Y (365*100 + 24)
26328 #define DAYS_PER_4Y (365*4 + 1)
26329 
26330 int __secs_to_tm(long long t, struct tm *tm)
26331 {
26332  long long days, secs, years;
26333  int remdays, remsecs, remyears;
26334  int qc_cycles, c_cycles, q_cycles;
26335  int months;
26336  int wday, yday, leap;
26337  static const char days_in_month[] = {31,30,31,30,31,31,30,31,30,31,31,29};
26338 
26339  /* Reject time_t values whose year would overflow int */
26340  if (t < INT_MIN * 31622400LL || t > INT_MAX * 31622400LL)
26341  return -1;
26342 
26343  secs = t - LEAPOCH;
26344  days = secs / 86400LL;
26345  remsecs = (int)(secs % 86400);
26346  if (remsecs < 0) {
26347  remsecs += 86400;
26348  --days;
26349  }
26350 
26351  wday = (int)((3+days)%7);
26352  if (wday < 0) wday += 7;
26353 
26354  qc_cycles = (int)(days / DAYS_PER_400Y);
26355  remdays = (int)(days % DAYS_PER_400Y);
26356  if (remdays < 0) {
26357  remdays += DAYS_PER_400Y;
26358  --qc_cycles;
26359  }
26360 
26361  c_cycles = remdays / DAYS_PER_100Y;
26362  if (c_cycles == 4) --c_cycles;
26363  remdays -= c_cycles * DAYS_PER_100Y;
26364 
26365  q_cycles = remdays / DAYS_PER_4Y;
26366  if (q_cycles == 25) --q_cycles;
26367  remdays -= q_cycles * DAYS_PER_4Y;
26368 
26369  remyears = remdays / 365;
26370  if (remyears == 4) --remyears;
26371  remdays -= remyears * 365;
26372 
26373  leap = !remyears && (q_cycles || !c_cycles);
26374  yday = remdays + 31 + 28 + leap;
26375  if (yday >= 365+leap) yday -= 365+leap;
26376 
26377  years = remyears + 4*q_cycles + 100*c_cycles + 400LL*qc_cycles;
26378 
26379  for (months=0; days_in_month[months] <= remdays; ++months)
26380  remdays -= days_in_month[months];
26381 
26382  if (years+100 > INT_MAX || years+100 < INT_MIN)
26383  return -1;
26384 
26385  tm->tm_year = (int)(years + 100);
26386  tm->tm_mon = months + 2;
26387  if (tm->tm_mon >= 12) {
26388  tm->tm_mon -=12;
26389  ++tm->tm_year;
26390  }
26391  tm->tm_mday = remdays + 1;
26392  tm->tm_wday = wday;
26393  tm->tm_yday = yday;
26394 
26395  tm->tm_hour = remsecs / 3600;
26396  tm->tm_min = remsecs / 60 % 60;
26397  tm->tm_sec = remsecs % 60;
26398 
26399  return 0;
26400 }
26401 
26402 /*********************************** amalgamated original file "/home/iosb/sw/open62541/deps/pcg_basic.c" ***********************************/
26403 
26404 /*
26405  * PCG Random Number Generation for C.
26406  *
26407  * Copyright 2014 Melissa O'Neill <oneill@pcg-random.org>
26408  *
26409  * Licensed under the Apache License, Version 2.0 (the "License");
26410  * you may not use this file except in compliance with the License.
26411  * You may obtain a copy of the License at
26412  *
26413  * http://www.apache.org/licenses/LICENSE-2.0
26414  *
26415  * Unless required by applicable law or agreed to in writing, software
26416  * distributed under the License is distributed on an "AS IS" BASIS,
26417  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
26418  * See the License for the specific language governing permissions and
26419  * limitations under the License.
26420  *
26421  * For additional information about the PCG random number generation scheme,
26422  * including its license and other licensing options, visit
26423  *
26424  * http://www.pcg-random.org
26425  */
26426 
26427 
26428 void pcg32_srandom_r(pcg32_random_t* rng, uint64_t initial_state, uint64_t initseq) {
26429  rng->state = 0U;
26430  rng->inc = (initseq << 1u) | 1u;
26431  pcg32_random_r(rng);
26432  rng->state += initial_state;
26433  pcg32_random_r(rng);
26434 }
26435 
26437  uint64_t oldstate = rng->state;
26438  rng->state = oldstate * 6364136223846793005ULL + rng->inc;
26439  uint32_t xorshifted = (uint32_t)(((oldstate >> 18u) ^ oldstate) >> 27u);
26440  uint32_t rot = (uint32_t)(oldstate >> 59u);
26441  return (xorshifted >> rot) | (xorshifted << ((~rot + 1u) & 31)); /* was (xorshifted >> rot) | (xorshifted << ((-rot) & 31)) */
26442 }
26443 
26444 /*********************************** amalgamated original file "/home/iosb/sw/open62541/build/src_generated/ua_statuscode_descriptions.c" ***********************************/
26445 
26446 /**********************************************************
26447  * Autogenerated -- do not modify
26448  * Generated from /home/iosb/sw/open62541/tools/schema/Opc.Ua.StatusCodes.csv with script /home/iosb/sw/open62541/tools/generate_statuscode_descriptions.py
26449  *********************************************************/
26450 
26451 
26452 #ifndef UA_ENABLE_STATUSCODE_DESCRIPTIONS
26453 static const size_t statusCodeDescriptionsSize = 1;
26454 static const UA_StatusCodeDescription statusCodeDescriptions[1] = {
26455  {0xffffffff, "StatusCode descriptions not available", "open62541 was compiled without support for statuscode descriptions"}
26456 };
26457 #else
26458 static const size_t statusCodeDescriptionsSize = 229;
26459 static const UA_StatusCodeDescription statusCodeDescriptions[229] =
26460 {
26461  {UA_STATUSCODE_GOOD, "Good", "Success / No error"},
26462  {UA_STATUSCODE_BADUNEXPECTEDERROR, "BadUnexpectedError", "An unexpected error occurred."},
26463  {UA_STATUSCODE_BADINTERNALERROR, "BadInternalError", "An internal error occurred as a result of a programming or configuration error."},
26464  {UA_STATUSCODE_BADOUTOFMEMORY, "BadOutOfMemory", "Not enough memory to complete the operation."},
26465  {UA_STATUSCODE_BADRESOURCEUNAVAILABLE, "BadResourceUnavailable", "An operating system resource is not available."},
26466  {UA_STATUSCODE_BADCOMMUNICATIONERROR, "BadCommunicationError", "A low level communication error occurred."},
26467  {UA_STATUSCODE_BADENCODINGERROR, "BadEncodingError", "Encoding halted because of invalid data in the objects being serialized."},
26468  {UA_STATUSCODE_BADDECODINGERROR, "BadDecodingError", "Decoding halted because of invalid data in the stream."},
26469  {UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED, "BadEncodingLimitsExceeded", "The message encoding/decoding limits imposed by the stack have been exceeded."},
26470  {UA_STATUSCODE_BADREQUESTTOOLARGE, "BadRequestTooLarge", "The request message size exceeds limits set by the server."},
26471  {UA_STATUSCODE_BADRESPONSETOOLARGE, "BadResponseTooLarge", "The response message size exceeds limits set by the client."},
26472  {UA_STATUSCODE_BADUNKNOWNRESPONSE, "BadUnknownResponse", "An unrecognized response was received from the server."},
26473  {UA_STATUSCODE_BADTIMEOUT, "BadTimeout", "The operation timed out."},
26474  {UA_STATUSCODE_BADSERVICEUNSUPPORTED, "BadServiceUnsupported", "The server does not support the requested service."},
26475  {UA_STATUSCODE_BADSHUTDOWN, "BadShutdown", "The operation was cancelled because the application is shutting down."},
26476  {UA_STATUSCODE_BADSERVERNOTCONNECTED, "BadServerNotConnected", "The operation could not complete because the client is not connected to the server."},
26477  {UA_STATUSCODE_BADSERVERHALTED, "BadServerHalted", "The server has stopped and cannot process any requests."},
26478  {UA_STATUSCODE_BADNOTHINGTODO, "BadNothingToDo", "There was nothing to do because the client passed a list of operations with no elements."},
26479  {UA_STATUSCODE_BADTOOMANYOPERATIONS, "BadTooManyOperations", "The request could not be processed because it specified too many operations."},
26480  {UA_STATUSCODE_BADTOOMANYMONITOREDITEMS, "BadTooManyMonitoredItems", "The request could not be processed because there are too many monitored items in the subscription."},
26481  {UA_STATUSCODE_BADDATATYPEIDUNKNOWN, "BadDataTypeIdUnknown", "The extension object cannot be (de)serialized because the data type id is not recognized."},
26482  {UA_STATUSCODE_BADCERTIFICATEINVALID, "BadCertificateInvalid", "The certificate provided as a parameter is not valid."},
26483  {UA_STATUSCODE_BADSECURITYCHECKSFAILED, "BadSecurityChecksFailed", "An error occurred verifying security."},
26484  {UA_STATUSCODE_BADCERTIFICATETIMEINVALID, "BadCertificateTimeInvalid", "The Certificate has expired or is not yet valid."},
26485  {UA_STATUSCODE_BADCERTIFICATEISSUERTIMEINVALID, "BadCertificateIssuerTimeInvalid", "An Issuer Certificate has expired or is not yet valid."},
26486  {UA_STATUSCODE_BADCERTIFICATEHOSTNAMEINVALID, "BadCertificateHostNameInvalid", "The HostName used to connect to a Server does not match a HostName in the Certificate."},
26487  {UA_STATUSCODE_BADCERTIFICATEURIINVALID, "BadCertificateUriInvalid", "The URI specified in the ApplicationDescription does not match the URI in the Certificate."},
26488  {UA_STATUSCODE_BADCERTIFICATEUSENOTALLOWED, "BadCertificateUseNotAllowed", "The Certificate may not be used for the requested operation."},
26489  {UA_STATUSCODE_BADCERTIFICATEISSUERUSENOTALLOWED, "BadCertificateIssuerUseNotAllowed", "The Issuer Certificate may not be used for the requested operation."},
26490  {UA_STATUSCODE_BADCERTIFICATEUNTRUSTED, "BadCertificateUntrusted", "The Certificate is not trusted."},
26491  {UA_STATUSCODE_BADCERTIFICATEREVOCATIONUNKNOWN, "BadCertificateRevocationUnknown", "It was not possible to determine if the Certificate has been revoked."},
26492  {UA_STATUSCODE_BADCERTIFICATEISSUERREVOCATIONUNKNOWN, "BadCertificateIssuerRevocationUnknown", "It was not possible to determine if the Issuer Certificate has been revoked."},
26493  {UA_STATUSCODE_BADCERTIFICATEREVOKED, "BadCertificateRevoked", "The certificate has been revoked."},
26494  {UA_STATUSCODE_BADCERTIFICATEISSUERREVOKED, "BadCertificateIssuerRevoked", "The issuer certificate has been revoked."},
26495  {UA_STATUSCODE_BADCERTIFICATECHAININCOMPLETE, "BadCertificateChainIncomplete", "The certificate chain is incomplete."},
26496  {UA_STATUSCODE_BADUSERACCESSDENIED, "BadUserAccessDenied", "User does not have permission to perform the requested operation."},
26497  {UA_STATUSCODE_BADIDENTITYTOKENINVALID, "BadIdentityTokenInvalid", "The user identity token is not valid."},
26498  {UA_STATUSCODE_BADIDENTITYTOKENREJECTED, "BadIdentityTokenRejected", "The user identity token is valid but the server has rejected it."},
26499  {UA_STATUSCODE_BADSECURECHANNELIDINVALID, "BadSecureChannelIdInvalid", "The specified secure channel is no longer valid."},
26500  {UA_STATUSCODE_BADINVALIDTIMESTAMP, "BadInvalidTimestamp", "The timestamp is outside the range allowed by the server."},
26501  {UA_STATUSCODE_BADNONCEINVALID, "BadNonceInvalid", "The nonce does appear to be not a random value or it is not the correct length."},
26502  {UA_STATUSCODE_BADSESSIONIDINVALID, "BadSessionIdInvalid", "The session id is not valid."},
26503  {UA_STATUSCODE_BADSESSIONCLOSED, "BadSessionClosed", "The session was closed by the client."},
26504  {UA_STATUSCODE_BADSESSIONNOTACTIVATED, "BadSessionNotActivated", "The session cannot be used because ActivateSession has not been called."},
26505  {UA_STATUSCODE_BADSUBSCRIPTIONIDINVALID, "BadSubscriptionIdInvalid", "The subscription id is not valid."},
26506  {UA_STATUSCODE_BADREQUESTHEADERINVALID, "BadRequestHeaderInvalid", "The header for the request is missing or invalid."},
26507  {UA_STATUSCODE_BADTIMESTAMPSTORETURNINVALID, "BadTimestampsToReturnInvalid", "The timestamps to return parameter is invalid."},
26508  {UA_STATUSCODE_BADREQUESTCANCELLEDBYCLIENT, "BadRequestCancelledByClient", "The request was cancelled by the client."},
26509  {UA_STATUSCODE_BADTOOMANYARGUMENTS, "BadTooManyArguments", "Too many arguments were provided."},
26510  {UA_STATUSCODE_GOODSUBSCRIPTIONTRANSFERRED, "GoodSubscriptionTransferred", "The subscription was transferred to another session."},
26511  {UA_STATUSCODE_GOODCOMPLETESASYNCHRONOUSLY, "GoodCompletesAsynchronously", "The processing will complete asynchronously."},
26512  {UA_STATUSCODE_GOODOVERLOAD, "GoodOverload", "Sampling has slowed down due to resource limitations."},
26513  {UA_STATUSCODE_GOODCLAMPED, "GoodClamped", "The value written was accepted but was clamped."},
26514  {UA_STATUSCODE_BADNOCOMMUNICATION, "BadNoCommunication", "Communication with the data source is defined"},
26515  {UA_STATUSCODE_BADWAITINGFORINITIALDATA, "BadWaitingForInitialData", "Waiting for the server to obtain values from the underlying data source."},
26516  {UA_STATUSCODE_BADNODEIDINVALID, "BadNodeIdInvalid", "The syntax of the node id is not valid."},
26517  {UA_STATUSCODE_BADNODEIDUNKNOWN, "BadNodeIdUnknown", "The node id refers to a node that does not exist in the server address space."},
26518  {UA_STATUSCODE_BADATTRIBUTEIDINVALID, "BadAttributeIdInvalid", "The attribute is not supported for the specified Node."},
26519  {UA_STATUSCODE_BADINDEXRANGEINVALID, "BadIndexRangeInvalid", "The syntax of the index range parameter is invalid."},
26520  {UA_STATUSCODE_BADINDEXRANGENODATA, "BadIndexRangeNoData", "No data exists within the range of indexes specified."},
26521  {UA_STATUSCODE_BADDATAENCODINGINVALID, "BadDataEncodingInvalid", "The data encoding is invalid."},
26522  {UA_STATUSCODE_BADDATAENCODINGUNSUPPORTED, "BadDataEncodingUnsupported", "The server does not support the requested data encoding for the node."},
26523  {UA_STATUSCODE_BADNOTREADABLE, "BadNotReadable", "The access level does not allow reading or subscribing to the Node."},
26524  {UA_STATUSCODE_BADNOTWRITABLE, "BadNotWritable", "The access level does not allow writing to the Node."},
26525  {UA_STATUSCODE_BADOUTOFRANGE, "BadOutOfRange", "The value was out of range."},
26526  {UA_STATUSCODE_BADNOTSUPPORTED, "BadNotSupported", "The requested operation is not supported."},
26527  {UA_STATUSCODE_BADNOTFOUND, "BadNotFound", "A requested item was not found or a search operation ended without success."},
26528  {UA_STATUSCODE_BADOBJECTDELETED, "BadObjectDeleted", "The object cannot be used because it has been deleted."},
26529  {UA_STATUSCODE_BADNOTIMPLEMENTED, "BadNotImplemented", "Requested operation is not implemented."},
26530  {UA_STATUSCODE_BADMONITORINGMODEINVALID, "BadMonitoringModeInvalid", "The monitoring mode is invalid."},
26531  {UA_STATUSCODE_BADMONITOREDITEMIDINVALID, "BadMonitoredItemIdInvalid", "The monitoring item id does not refer to a valid monitored item."},
26532  {UA_STATUSCODE_BADMONITOREDITEMFILTERINVALID, "BadMonitoredItemFilterInvalid", "The monitored item filter parameter is not valid."},
26533  {UA_STATUSCODE_BADMONITOREDITEMFILTERUNSUPPORTED, "BadMonitoredItemFilterUnsupported", "The server does not support the requested monitored item filter."},
26534  {UA_STATUSCODE_BADFILTERNOTALLOWED, "BadFilterNotAllowed", "A monitoring filter cannot be used in combination with the attribute specified."},
26535  {UA_STATUSCODE_BADSTRUCTUREMISSING, "BadStructureMissing", "A mandatory structured parameter was missing or null."},
26536  {UA_STATUSCODE_BADEVENTFILTERINVALID, "BadEventFilterInvalid", "The event filter is not valid."},
26537  {UA_STATUSCODE_BADCONTENTFILTERINVALID, "BadContentFilterInvalid", "The content filter is not valid."},
26538  {UA_STATUSCODE_BADFILTEROPERATORINVALID, "BadFilterOperatorInvalid", "An unregognized operator was provided in a filter."},
26539  {UA_STATUSCODE_BADFILTEROPERATORUNSUPPORTED, "BadFilterOperatorUnsupported", "A valid operator was provided"},
26540  {UA_STATUSCODE_BADFILTEROPERANDCOUNTMISMATCH, "BadFilterOperandCountMismatch", "The number of operands provided for the filter operator was less then expected for the operand provided."},
26541  {UA_STATUSCODE_BADFILTEROPERANDINVALID, "BadFilterOperandInvalid", "The operand used in a content filter is not valid."},
26542  {UA_STATUSCODE_BADFILTERELEMENTINVALID, "BadFilterElementInvalid", "The referenced element is not a valid element in the content filter."},
26543  {UA_STATUSCODE_BADFILTERLITERALINVALID, "BadFilterLiteralInvalid", "The referenced literal is not a valid value."},
26544  {UA_STATUSCODE_BADCONTINUATIONPOINTINVALID, "BadContinuationPointInvalid", "The continuation point provide is longer valid."},
26545  {UA_STATUSCODE_BADNOCONTINUATIONPOINTS, "BadNoContinuationPoints", "The operation could not be processed because all continuation points have been allocated."},
26546  {UA_STATUSCODE_BADREFERENCETYPEIDINVALID, "BadReferenceTypeIdInvalid", "The operation could not be processed because all continuation points have been allocated."},
26547  {UA_STATUSCODE_BADBROWSEDIRECTIONINVALID, "BadBrowseDirectionInvalid", "The browse direction is not valid."},
26548  {UA_STATUSCODE_BADNODENOTINVIEW, "BadNodeNotInView", "The node is not part of the view."},
26549  {UA_STATUSCODE_BADSERVERURIINVALID, "BadServerUriInvalid", "The ServerUri is not a valid URI."},
26550  {UA_STATUSCODE_BADSERVERNAMEMISSING, "BadServerNameMissing", "No ServerName was specified."},
26551  {UA_STATUSCODE_BADDISCOVERYURLMISSING, "BadDiscoveryUrlMissing", "No DiscoveryUrl was specified."},
26552  {UA_STATUSCODE_BADSEMPAHOREFILEMISSING, "BadSempahoreFileMissing", "The semaphore file specified by the client is not valid."},
26553  {UA_STATUSCODE_BADREQUESTTYPEINVALID, "BadRequestTypeInvalid", "The security token request type is not valid."},
26554  {UA_STATUSCODE_BADSECURITYMODEREJECTED, "BadSecurityModeRejected", "The security mode does not meet the requirements set by the Server."},
26555  {UA_STATUSCODE_BADSECURITYPOLICYREJECTED, "BadSecurityPolicyRejected", "The security policy does not meet the requirements set by the Server."},
26556  {UA_STATUSCODE_BADTOOMANYSESSIONS, "BadTooManySessions", "The server has reached its maximum number of sessions."},
26557  {UA_STATUSCODE_BADUSERSIGNATUREINVALID, "BadUserSignatureInvalid", "The user token signature is missing or invalid."},
26558  {UA_STATUSCODE_BADAPPLICATIONSIGNATUREINVALID, "BadApplicationSignatureInvalid", "The signature generated with the client certificate is missing or invalid."},
26559  {UA_STATUSCODE_BADNOVALIDCERTIFICATES, "BadNoValidCertificates", "The client did not provide at least one software certificate that is valid and meets the profile requirements for the server."},
26560  {UA_STATUSCODE_BADIDENTITYCHANGENOTSUPPORTED, "BadIdentityChangeNotSupported", "The Server does not support changing the user identity assigned to the session."},
26561  {UA_STATUSCODE_BADREQUESTCANCELLEDBYREQUEST, "BadRequestCancelledByRequest", "The request was cancelled by the client with the Cancel service."},
26562  {UA_STATUSCODE_BADPARENTNODEIDINVALID, "BadParentNodeIdInvalid", "The parent node id does not to refer to a valid node."},
26563  {UA_STATUSCODE_BADREFERENCENOTALLOWED, "BadReferenceNotAllowed", "The reference could not be created because it violates constraints imposed by the data model."},
26564  {UA_STATUSCODE_BADNODEIDREJECTED, "BadNodeIdRejected", "The requested node id was reject because it was either invalid or server does not allow node ids to be specified by the client."},
26565  {UA_STATUSCODE_BADNODEIDEXISTS, "BadNodeIdExists", "The requested node id is already used by another node."},
26566  {UA_STATUSCODE_BADNODECLASSINVALID, "BadNodeClassInvalid", "The node class is not valid."},
26567  {UA_STATUSCODE_BADBROWSENAMEINVALID, "BadBrowseNameInvalid", "The browse name is invalid."},
26568  {UA_STATUSCODE_BADBROWSENAMEDUPLICATED, "BadBrowseNameDuplicated", "The browse name is not unique among nodes that share the same relationship with the parent."},
26569  {UA_STATUSCODE_BADNODEATTRIBUTESINVALID, "BadNodeAttributesInvalid", "The node attributes are not valid for the node class."},
26570  {UA_STATUSCODE_BADTYPEDEFINITIONINVALID, "BadTypeDefinitionInvalid", "The type definition node id does not reference an appropriate type node."},
26571  {UA_STATUSCODE_BADSOURCENODEIDINVALID, "BadSourceNodeIdInvalid", "The source node id does not reference a valid node."},
26572  {UA_STATUSCODE_BADTARGETNODEIDINVALID, "BadTargetNodeIdInvalid", "The target node id does not reference a valid node."},
26573  {UA_STATUSCODE_BADDUPLICATEREFERENCENOTALLOWED, "BadDuplicateReferenceNotAllowed", "The reference type between the nodes is already defined."},
26574  {UA_STATUSCODE_BADINVALIDSELFREFERENCE, "BadInvalidSelfReference", "The server does not allow this type of self reference on this node."},
26575  {UA_STATUSCODE_BADREFERENCELOCALONLY, "BadReferenceLocalOnly", "The reference type is not valid for a reference to a remote server."},
26576  {UA_STATUSCODE_BADNODELETERIGHTS, "BadNoDeleteRights", "The server will not allow the node to be deleted."},
26577  {UA_STATUSCODE_UNCERTAINREFERENCENOTDELETED, "UncertainReferenceNotDeleted", "The server was not able to delete all target references."},
26578  {UA_STATUSCODE_BADSERVERINDEXINVALID, "BadServerIndexInvalid", "The server index is not valid."},
26579  {UA_STATUSCODE_BADVIEWIDUNKNOWN, "BadViewIdUnknown", "The view id does not refer to a valid view node."},
26580  {UA_STATUSCODE_BADVIEWTIMESTAMPINVALID, "BadViewTimestampInvalid", "The view timestamp is not available or not supported."},
26581  {UA_STATUSCODE_BADVIEWPARAMETERMISMATCH, "BadViewParameterMismatch", "The view parameters are not consistent with each other."},
26582  {UA_STATUSCODE_BADVIEWVERSIONINVALID, "BadViewVersionInvalid", "The view version is not available or not supported."},
26583  {UA_STATUSCODE_UNCERTAINNOTALLNODESAVAILABLE, "UncertainNotAllNodesAvailable", "The list of references may not be complete because the underlying system is not available."},
26584  {UA_STATUSCODE_GOODRESULTSMAYBEINCOMPLETE, "GoodResultsMayBeIncomplete", "The server should have followed a reference to a node in a remote server but did not. The result set may be incomplete."},
26585  {UA_STATUSCODE_BADNOTTYPEDEFINITION, "BadNotTypeDefinition", "The provided Nodeid was not a type definition nodeid."},
26586  {UA_STATUSCODE_UNCERTAINREFERENCEOUTOFSERVER, "UncertainReferenceOutOfServer", "One of the references to follow in the relative path references to a node in the address space in another server."},
26587  {UA_STATUSCODE_BADTOOMANYMATCHES, "BadTooManyMatches", "The requested operation has too many matches to return."},
26588  {UA_STATUSCODE_BADQUERYTOOCOMPLEX, "BadQueryTooComplex", "The requested operation requires too many resources in the server."},
26589  {UA_STATUSCODE_BADNOMATCH, "BadNoMatch", "The requested operation has no match to return."},
26590  {UA_STATUSCODE_BADMAXAGEINVALID, "BadMaxAgeInvalid", "The max age parameter is invalid."},
26591  {UA_STATUSCODE_BADSECURITYMODEINSUFFICIENT, "BadSecurityModeInsufficient", "The operation is not permitted over the current secure channel."},
26592  {UA_STATUSCODE_BADHISTORYOPERATIONINVALID, "BadHistoryOperationInvalid", "The history details parameter is not valid."},
26593  {UA_STATUSCODE_BADHISTORYOPERATIONUNSUPPORTED, "BadHistoryOperationUnsupported", "The server does not support the requested operation."},
26594  {UA_STATUSCODE_BADINVALIDTIMESTAMPARGUMENT, "BadInvalidTimestampArgument", "The defined timestamp to return was invalid."},
26595  {UA_STATUSCODE_BADWRITENOTSUPPORTED, "BadWriteNotSupported", "The server not does support writing the combination of value"},
26596  {UA_STATUSCODE_BADTYPEMISMATCH, "BadTypeMismatch", "The value supplied for the attribute is not of the same type as the attribute's value."},
26597  {UA_STATUSCODE_BADMETHODINVALID, "BadMethodInvalid", "The method id does not refer to a method for the specified object."},
26598  {UA_STATUSCODE_BADARGUMENTSMISSING, "BadArgumentsMissing", "The client did not specify all of the input arguments for the method."},
26599  {UA_STATUSCODE_BADTOOMANYSUBSCRIPTIONS, "BadTooManySubscriptions", "The server has reached its maximum number of subscriptions."},
26600  {UA_STATUSCODE_BADTOOMANYPUBLISHREQUESTS, "BadTooManyPublishRequests", "The server has reached the maximum number of queued publish requests."},
26601  {UA_STATUSCODE_BADNOSUBSCRIPTION, "BadNoSubscription", "There is no subscription available for this session."},
26602  {UA_STATUSCODE_BADSEQUENCENUMBERUNKNOWN, "BadSequenceNumberUnknown", "The sequence number is unknown to the server."},
26603  {UA_STATUSCODE_BADMESSAGENOTAVAILABLE, "BadMessageNotAvailable", "The requested notification message is no longer available."},
26604  {UA_STATUSCODE_BADINSUFFICIENTCLIENTPROFILE, "BadInsufficientClientProfile", "The Client of the current Session does not support one or more Profiles that are necessary for the Subscription."},
26605  {UA_STATUSCODE_BADSTATENOTACTIVE, "BadStateNotActive", "The sub-state machine is not currently active."},
26606  {UA_STATUSCODE_BADTCPSERVERTOOBUSY, "BadTcpServerTooBusy", "The server cannot process the request because it is too busy."},
26607  {UA_STATUSCODE_BADTCPMESSAGETYPEINVALID, "BadTcpMessageTypeInvalid", "The type of the message specified in the header invalid."},
26608  {UA_STATUSCODE_BADTCPSECURECHANNELUNKNOWN, "BadTcpSecureChannelUnknown", "The SecureChannelId and/or TokenId are not currently in use."},
26609  {UA_STATUSCODE_BADTCPMESSAGETOOLARGE, "BadTcpMessageTooLarge", "The size of the message specified in the header is too large."},
26610  {UA_STATUSCODE_BADTCPNOTENOUGHRESOURCES, "BadTcpNotEnoughResources", "There are not enough resources to process the request."},
26611  {UA_STATUSCODE_BADTCPINTERNALERROR, "BadTcpInternalError", "An internal error occurred."},
26612  {UA_STATUSCODE_BADTCPENDPOINTURLINVALID, "BadTcpEndpointUrlInvalid", "The Server does not recognize the QueryString specified."},
26613  {UA_STATUSCODE_BADREQUESTINTERRUPTED, "BadRequestInterrupted", "The request could not be sent because of a network interruption."},
26614  {UA_STATUSCODE_BADREQUESTTIMEOUT, "BadRequestTimeout", "Timeout occurred while processing the request."},
26615  {UA_STATUSCODE_BADSECURECHANNELCLOSED, "BadSecureChannelClosed", "The secure channel has been closed."},
26616  {UA_STATUSCODE_BADSECURECHANNELTOKENUNKNOWN, "BadSecureChannelTokenUnknown", "The token has expired or is not recognized."},
26617  {UA_STATUSCODE_BADSEQUENCENUMBERINVALID, "BadSequenceNumberInvalid", "The sequence number is not valid."},
26618  {UA_STATUSCODE_BADPROTOCOLVERSIONUNSUPPORTED, "BadProtocolVersionUnsupported", "The applications do not have compatible protocol versions."},
26619  {UA_STATUSCODE_BADCONFIGURATIONERROR, "BadConfigurationError", "There is a problem with the configuration that affects the usefulness of the value."},
26620  {UA_STATUSCODE_BADNOTCONNECTED, "BadNotConnected", "The variable should receive its value from another variable"},
26621  {UA_STATUSCODE_BADDEVICEFAILURE, "BadDeviceFailure", "There has been a failure in the device/data source that generates the value that has affected the value."},
26622  {UA_STATUSCODE_BADSENSORFAILURE, "BadSensorFailure", "There has been a failure in the sensor from which the value is derived by the device/data source."},
26623  {UA_STATUSCODE_BADOUTOFSERVICE, "BadOutOfService", "The source of the data is not operational."},
26624  {UA_STATUSCODE_BADDEADBANDFILTERINVALID, "BadDeadbandFilterInvalid", "The deadband filter is not valid."},
26625  {UA_STATUSCODE_UNCERTAINNOCOMMUNICATIONLASTUSABLEVALUE, "UncertainNoCommunicationLastUsableValue", "Communication to the data source has failed. The variable value is the last value that had a good quality."},
26626  {UA_STATUSCODE_UNCERTAINLASTUSABLEVALUE, "UncertainLastUsableValue", "Whatever was updating this value has stopped doing so."},
26627  {UA_STATUSCODE_UNCERTAINSUBSTITUTEVALUE, "UncertainSubstituteValue", "The value is an operational value that was manually overwritten."},
26628  {UA_STATUSCODE_UNCERTAININITIALVALUE, "UncertainInitialValue", "The value is an initial value for a variable that normally receives its value from another variable."},
26629  {UA_STATUSCODE_UNCERTAINSENSORNOTACCURATE, "UncertainSensorNotAccurate", "The value is at one of the sensor limits."},
26630  {UA_STATUSCODE_UNCERTAINENGINEERINGUNITSEXCEEDED, "UncertainEngineeringUnitsExceeded", "The value is outside of the range of values defined for this parameter."},
26631  {UA_STATUSCODE_UNCERTAINSUBNORMAL, "UncertainSubNormal", "The value is derived from multiple sources and has less than the required number of Good sources."},
26632  {UA_STATUSCODE_GOODLOCALOVERRIDE, "GoodLocalOverride", "The value has been overridden."},
26633  {UA_STATUSCODE_BADREFRESHINPROGRESS, "BadRefreshInProgress", "This Condition refresh failed"},
26634  {UA_STATUSCODE_BADCONDITIONALREADYDISABLED, "BadConditionAlreadyDisabled", "This condition has already been disabled."},
26635  {UA_STATUSCODE_BADCONDITIONALREADYENABLED, "BadConditionAlreadyEnabled", "This condition has already been enabled."},
26636  {UA_STATUSCODE_BADCONDITIONDISABLED, "BadConditionDisabled", "Property not available"},
26637  {UA_STATUSCODE_BADEVENTIDUNKNOWN, "BadEventIdUnknown", "The specified event id is not recognized."},
26638  {UA_STATUSCODE_BADEVENTNOTACKNOWLEDGEABLE, "BadEventNotAcknowledgeable", "The event cannot be acknowledged."},
26639  {UA_STATUSCODE_BADDIALOGNOTACTIVE, "BadDialogNotActive", "The dialog condition is not active."},
26640  {UA_STATUSCODE_BADDIALOGRESPONSEINVALID, "BadDialogResponseInvalid", "The response is not valid for the dialog."},
26641  {UA_STATUSCODE_BADCONDITIONBRANCHALREADYACKED, "BadConditionBranchAlreadyAcked", "The condition branch has already been acknowledged."},
26642  {UA_STATUSCODE_BADCONDITIONBRANCHALREADYCONFIRMED, "BadConditionBranchAlreadyConfirmed", "The condition branch has already been confirmed."},
26643  {UA_STATUSCODE_BADCONDITIONALREADYSHELVED, "BadConditionAlreadyShelved", "The condition has already been shelved."},
26644  {UA_STATUSCODE_BADCONDITIONNOTSHELVED, "BadConditionNotShelved", "The condition is not currently shelved."},
26645  {UA_STATUSCODE_BADSHELVINGTIMEOUTOFRANGE, "BadShelvingTimeOutOfRange", "The shelving time not within an acceptable range."},
26646  {UA_STATUSCODE_BADNODATA, "BadNoData", "No data exists for the requested time range or event filter."},
26647  {UA_STATUSCODE_BADBOUNDNOTFOUND, "BadBoundNotFound", "No data found to provide upper or lower bound value."},
26648  {UA_STATUSCODE_BADBOUNDNOTSUPPORTED, "BadBoundNotSupported", "The server cannot retrieve a bound for the variable."},
26649  {UA_STATUSCODE_BADDATALOST, "BadDataLost", "Data is missing due to collection started/stopped/lost."},
26650  {UA_STATUSCODE_BADDATAUNAVAILABLE, "BadDataUnavailable", "Expected data is unavailable for the requested time range due to an un-mounted volume"},
26651  {UA_STATUSCODE_BADENTRYEXISTS, "BadEntryExists", "The data or event was not successfully inserted because a matching entry exists."},
26652  {UA_STATUSCODE_BADNOENTRYEXISTS, "BadNoEntryExists", "The data or event was not successfully updated because no matching entry exists."},
26653  {UA_STATUSCODE_BADTIMESTAMPNOTSUPPORTED, "BadTimestampNotSupported", "The client requested history using a timestamp format the server does not support (i.e requested ServerTimestamp when server only supports SourceTimestamp)."},
26654  {UA_STATUSCODE_GOODENTRYINSERTED, "GoodEntryInserted", "The data or event was successfully inserted into the historical database."},
26655  {UA_STATUSCODE_GOODENTRYREPLACED, "GoodEntryReplaced", "The data or event field was successfully replaced in the historical database."},
26656  {UA_STATUSCODE_UNCERTAINDATASUBNORMAL, "UncertainDataSubNormal", "The value is derived from multiple values and has less than the required number of Good values."},
26657  {UA_STATUSCODE_GOODNODATA, "GoodNoData", "No data exists for the requested time range or event filter."},
26658  {UA_STATUSCODE_GOODMOREDATA, "GoodMoreData", "The data or event field was successfully replaced in the historical database."},
26659  {UA_STATUSCODE_BADAGGREGATELISTMISMATCH, "BadAggregateListMismatch", "The requested number of Aggregates does not match the requested number of NodeIds."},
26660  {UA_STATUSCODE_BADAGGREGATENOTSUPPORTED, "BadAggregateNotSupported", "The requested Aggregate is not support by the server."},
26661  {UA_STATUSCODE_BADAGGREGATEINVALIDINPUTS, "BadAggregateInvalidInputs", "The aggregate value could not be derived due to invalid data inputs."},
26662  {UA_STATUSCODE_BADAGGREGATECONFIGURATIONREJECTED, "BadAggregateConfigurationRejected", "The aggregate configuration is not valid for specified node."},
26663  {UA_STATUSCODE_GOODDATAIGNORED, "GoodDataIgnored", "The request pecifies fields which are not valid for the EventType or cannot be saved by the historian."},
26664  {UA_STATUSCODE_BADREQUESTNOTALLOWED, "BadRequestNotAllowed", "The request was rejected by the server because it did not meet the criteria set by the server."},
26665  {UA_STATUSCODE_GOODEDITED, "GoodEdited", "The value does not come from the real source and has been edited by the server."},
26666  {UA_STATUSCODE_GOODPOSTACTIONFAILED, "GoodPostActionFailed", "There was an error in execution of these post-actions."},
26667  {UA_STATUSCODE_UNCERTAINDOMINANTVALUECHANGED, "UncertainDominantValueChanged", "The related EngineeringUnit has been changed but the Variable Value is still provided based on the previous unit."},
26668  {UA_STATUSCODE_GOODDEPENDENTVALUECHANGED, "GoodDependentValueChanged", "A dependent value has been changed but the change has not been applied to the device."},
26669  {UA_STATUSCODE_BADDOMINANTVALUECHANGED, "BadDominantValueChanged", "The related EngineeringUnit has been changed but this change has not been applied to the device. The Variable Value is still dependent on the previous unit but its status is currently Bad."},
26670  {UA_STATUSCODE_UNCERTAINDEPENDENTVALUECHANGED, "UncertainDependentValueChanged", "A dependent value has been changed but the change has not been applied to the device. The quality of the dominant variable is uncertain."},
26671  {UA_STATUSCODE_BADDEPENDENTVALUECHANGED, "BadDependentValueChanged", "A dependent value has been changed but the change has not been applied to the device. The quality of the dominant variable is Bad."},
26672  {UA_STATUSCODE_GOODCOMMUNICATIONEVENT, "GoodCommunicationEvent", "The communication layer has raised an event."},
26673  {UA_STATUSCODE_GOODSHUTDOWNEVENT, "GoodShutdownEvent", "The system is shutting down."},
26674  {UA_STATUSCODE_GOODCALLAGAIN, "GoodCallAgain", "The operation is not finished and needs to be called again."},
26675  {UA_STATUSCODE_GOODNONCRITICALTIMEOUT, "GoodNonCriticalTimeout", "A non-critical timeout occurred."},
26676  {UA_STATUSCODE_BADINVALIDARGUMENT, "BadInvalidArgument", "One or more arguments are invalid."},
26677  {UA_STATUSCODE_BADCONNECTIONREJECTED, "BadConnectionRejected", "Could not establish a network connection to remote server."},
26678  {UA_STATUSCODE_BADDISCONNECT, "BadDisconnect", "The server has disconnected from the client."},
26679  {UA_STATUSCODE_BADCONNECTIONCLOSED, "BadConnectionClosed", "The network connection has been closed."},
26680  {UA_STATUSCODE_BADINVALIDSTATE, "BadInvalidState", "The operation cannot be completed because the object is closed"},
26681  {UA_STATUSCODE_BADENDOFSTREAM, "BadEndOfStream", "Cannot move beyond end of the stream."},
26682  {UA_STATUSCODE_BADNODATAAVAILABLE, "BadNoDataAvailable", "No data is currently available for reading from a non-blocking stream."},
26683  {UA_STATUSCODE_BADWAITINGFORRESPONSE, "BadWaitingForResponse", "The asynchronous operation is waiting for a response."},
26684  {UA_STATUSCODE_BADOPERATIONABANDONED, "BadOperationAbandoned", "The asynchronous operation was abandoned by the caller."},
26685  {UA_STATUSCODE_BADEXPECTEDSTREAMTOBLOCK, "BadExpectedStreamToBlock", "The stream did not return all data requested (possibly because it is a non-blocking stream)."},
26686  {UA_STATUSCODE_BADWOULDBLOCK, "BadWouldBlock", "Non blocking behaviour is required and the operation would block."},
26687  {UA_STATUSCODE_BADSYNTAXERROR, "BadSyntaxError", "A value had an invalid syntax."},
26688  {UA_STATUSCODE_BADMAXCONNECTIONSREACHED, "BadMaxConnectionsReached", "The operation could not be finished because all available connections are in use."},
26689  {0xffffffff, "Unknown", "Unknown StatusCode"},
26690 };
26691 #endif
26692 
26695  for(size_t i = 0; i < statusCodeDescriptionsSize; ++i) {
26696  if(statusCodeDescriptions[i].code == code)
26697  return &statusCodeDescriptions[i];
26698  }
26699  return &statusCodeDescriptions[statusCodeDescriptionsSize-1];
26700 }
26701 
26702 
26703 /*********************************** amalgamated original file "/home/iosb/sw/open62541/plugins/ua_network_tcp.c" ***********************************/
26704 
26705 /* This work is licensed under a Creative Commons CCZero 1.0 Universal License.
26706  * See http://creativecommons.org/publicdomain/zero/1.0/ for more information. */
26707 
26708 #if defined(__MINGW32__) && (!defined(WINVER) || WINVER < 0x501)
26709 /* Assume the target is newer than Windows XP */
26710 # undef WINVER
26711 # undef _WIN32_WINDOWS
26712 # undef _WIN32_WINNT
26713 # define WINVER 0x0501
26714 # define _WIN32_WINDOWS 0x0501
26715 # define _WIN32_WINNT 0x0501
26716 #endif
26717 
26718 
26719 #include <stdlib.h> // malloc, free
26720 #include <stdio.h> // snprintf
26721 #include <string.h> // memset
26722 #include <errno.h>
26723 #ifdef _WIN32
26724 # ifndef __clang__
26725 # include <malloc.h>
26726 # endif
26727 /* Fix redefinition of SLIST_ENTRY on mingw winnt.h */
26728 # ifdef SLIST_ENTRY
26729 # undef SLIST_ENTRY
26730 # endif
26731 /* inet_ntoa is deprecated on MSVC but used for compatibility */
26732 # define _WINSOCK_DEPRECATED_NO_WARNINGS
26733 # include <winsock2.h>
26734 # include <ws2tcpip.h>
26735 # define CLOSESOCKET(S) closesocket((SOCKET)S)
26736 # define ssize_t int
26737 # define WIN32_INT (int)
26738 #else
26739 # define CLOSESOCKET(S) close(S)
26740 # define SOCKET int
26741 # define WIN32_INT
26742 # include <arpa/inet.h>
26743 # include <netinet/in.h>
26744 # include <sys/select.h>
26745 # include <sys/ioctl.h>
26746 # include <fcntl.h>
26747 # include <unistd.h> // read, write, close
26748 # include <netdb.h>
26749 # ifdef __QNX__
26750 # include <sys/socket.h>
26751 # endif
26752 #if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
26753 # include <sys/param.h>
26754 # if defined(BSD)
26755 # include<sys/socket.h>
26756 # endif
26757 #endif
26758 # ifndef __CYGWIN__
26759 # include <netinet/tcp.h>
26760 # endif
26761 #endif
26762 
26763 /* unsigned int for windows and workaround to a glibc bug */
26764 /* Additionally if GNU_LIBRARY is not defined, it may be using musl libc (e.g. Docker Alpine) */
26765 #if defined(_WIN32) || defined(__OpenBSD__) || \
26766  (defined(__GNU_LIBRARY__) && (__GNU_LIBRARY__ <= 6) && \
26767  (__GLIBC__ <= 2) && (__GLIBC_MINOR__ < 16) || \
26768  !defined(__GNU_LIBRARY__))
26769 # define UA_fd_set(fd, fds) FD_SET((unsigned int)fd, fds)
26770 # define UA_fd_isset(fd, fds) FD_ISSET((unsigned int)fd, fds)
26771 #else
26772 # define UA_fd_set(fd, fds) FD_SET(fd, fds)
26773 # define UA_fd_isset(fd, fds) FD_ISSET(fd, fds)
26774 #endif
26775 
26776 #ifdef UA_ENABLE_MULTITHREADING
26777 # include <urcu/uatomic.h>
26778 #endif
26779 
26780 #ifdef _WIN32
26781 #define errno__ WSAGetLastError()
26782 # define INTERRUPTED WSAEINTR
26783 # define WOULDBLOCK WSAEWOULDBLOCK
26784 # define AGAIN WSAEWOULDBLOCK
26785 #else
26786 # define errno__ errno
26787 # define INTERRUPTED EINTR
26788 # define WOULDBLOCK EWOULDBLOCK
26789 # define AGAIN EAGAIN
26790 #endif
26791 
26792 /****************************/
26793 /* Generic Socket Functions */
26794 /****************************/
26795 
26796 static void
26797 socket_close(UA_Connection *connection) {
26798  connection->state = UA_CONNECTION_CLOSED;
26799  shutdown((SOCKET)connection->sockfd,2);
26800  CLOSESOCKET(connection->sockfd);
26801 }
26802 
26803 static UA_StatusCode
26804 socket_write(UA_Connection *connection, UA_ByteString *buf) {
26805  size_t nWritten = 0;
26806  int flags = 0;
26807 #ifdef MSG_NOSIGNAL
26808  flags = MSG_NOSIGNAL;
26809 #endif
26810  do {
26811  ssize_t n = 0;
26812  do {
26813  /* If the OS throws EMSGSIZE, force a smaller packet size:
26814  * size_t bytes_to_send = buf->length - nWritten > 1024 ? 1024 : buf->length - nWritten; */
26815  size_t bytes_to_send = buf->length - nWritten;
26816  n = send((SOCKET)connection->sockfd, (const char*)buf->data + nWritten,
26817  WIN32_INT bytes_to_send, flags);
26818  if(n < 0 && errno__ != INTERRUPTED && errno__ != AGAIN) {
26819  connection->close(connection);
26820  socket_close(connection);
26821  UA_ByteString_deleteMembers(buf);
26823  }
26824  } while(n < 0);
26825  nWritten += (size_t)n;
26826  } while(nWritten < buf->length);
26827  UA_ByteString_deleteMembers(buf);
26828  return UA_STATUSCODE_GOOD;
26829 }
26830 
26831 static UA_StatusCode
26832 socket_recv(UA_Connection *connection, UA_ByteString *response, UA_UInt32 timeout) {
26833  response->data = malloc(connection->localConf.recvBufferSize);
26834  if(!response->data) {
26835  response->length = 0;
26836  return UA_STATUSCODE_BADOUTOFMEMORY; /* not enough memory retry */
26837  }
26838 
26839  if(timeout > 0) {
26840  /* currently, only the client uses timeouts */
26841 #ifndef _WIN32
26842  UA_UInt32 timeout_usec = timeout * 1000;
26843 # ifdef __APPLE__
26844  struct timeval tmptv = {(long int)(timeout_usec / 1000000), timeout_usec % 1000000};
26845 # else
26846  struct timeval tmptv = {(long int)(timeout_usec / 1000000), (long int)(timeout_usec % 1000000)};
26847 # endif
26848  int ret = setsockopt(connection->sockfd, SOL_SOCKET, SO_RCVTIMEO,
26849  (const char *)&tmptv, sizeof(struct timeval));
26850 #else
26851  DWORD timeout_dw = timeout;
26852  int ret = setsockopt(connection->sockfd, SOL_SOCKET, SO_RCVTIMEO,
26853  (const char*)&timeout_dw, sizeof(DWORD));
26854 #endif
26855  if(0 != ret) {
26856  UA_ByteString_deleteMembers(response);
26857  socket_close(connection);
26859  }
26860  }
26861 
26862 #ifdef __CYGWIN__
26863  /* Workaround for https://cygwin.com/ml/cygwin/2013-07/msg00107.html */
26864  ssize_t ret;
26865  if(timeout > 0) {
26866  fd_set fdset;
26867  FD_ZERO(&fdset);
26868  UA_fd_set(connection->sockfd, &fdset);
26869  UA_UInt32 timeout_usec = timeout * 1000;
26870  struct timeval tmptv = {(long int)(timeout_usec / 1000000),
26871  (long int)(timeout_usec % 1000000)};
26872  int retval = select(connection->sockfd+1, &fdset, NULL, NULL, &tmptv);
26873  if(retval && UA_fd_isset(connection->sockfd, &fdset)) {
26874  ret = recv(connection->sockfd, (char*)response->data,
26875  connection->localConf.recvBufferSize, 0);
26876  } else {
26877  ret = 0;
26878  }
26879  } else {
26880  ret = recv(connection->sockfd, (char*)response->data,
26881  connection->localConf.recvBufferSize, 0);
26882  }
26883 #else
26884  ssize_t ret = recv(connection->sockfd, (char*)response->data,
26885  connection->localConf.recvBufferSize, 0);
26886 #endif
26887 
26888  /* server has closed the connection */
26889  if(ret == 0) {
26890  UA_ByteString_deleteMembers(response);
26891  socket_close(connection);
26893  }
26894 
26895  /* error case */
26896  if(ret < 0) {
26897  UA_ByteString_deleteMembers(response);
26898  if(errno__ == INTERRUPTED || (timeout > 0) ?
26899  false : (errno__ == EAGAIN || errno__ == WOULDBLOCK))
26900  return UA_STATUSCODE_GOOD; /* statuscode_good but no data -> retry */
26901  socket_close(connection);
26903  }
26904 
26905  /* default case */
26906  response->length = (size_t)ret;
26907  return UA_STATUSCODE_GOOD;
26908 }
26909 
26910 static UA_StatusCode socket_set_nonblocking(SOCKET sockfd) {
26911 #ifdef _WIN32
26912  u_long iMode = 1;
26913  if(ioctlsocket(sockfd, FIONBIO, &iMode) != NO_ERROR)
26915 #else
26916  int opts = fcntl(sockfd, F_GETFL);
26917  if(opts < 0 || fcntl(sockfd, F_SETFL, opts|O_NONBLOCK) < 0)
26919 #endif
26920  return UA_STATUSCODE_GOOD;
26921 }
26922 
26923 static void FreeConnectionCallback(UA_Server *server, void *ptr) {
26925  free(ptr);
26926  }
26927 
26928 /***************************/
26929 /* Server NetworkLayer TCP */
26930 /***************************/
26931 
26965 #define MAXBACKLOG 100
26966 
26967 typedef struct {
26970  UA_Logger logger; // Set during start
26971 
26972  /* open sockets and connections */
26978  } *mappings;
26980 
26981 static UA_StatusCode
26982 ServerNetworkLayerGetSendBuffer(UA_Connection *connection, size_t length, UA_ByteString *buf) {
26983  if(length > connection->remoteConf.recvBufferSize)
26985  return UA_ByteString_allocBuffer(buf, length);
26986 }
26987 
26988 static void
26989 ServerNetworkLayerReleaseSendBuffer(UA_Connection *connection, UA_ByteString *buf) {
26990  UA_ByteString_deleteMembers(buf);
26991 }
26992 
26993 static void
26994 ServerNetworkLayerReleaseRecvBuffer(UA_Connection *connection, UA_ByteString *buf) {
26995  UA_ByteString_deleteMembers(buf);
26996 }
26997 
26998 /* after every select, we need to reset the sockets we want to listen on */
26999 static UA_Int32
27000 setFDSet(ServerNetworkLayerTCP *layer, fd_set *fdset) {
27001  FD_ZERO(fdset);
27002  UA_fd_set(layer->serversockfd, fdset);
27003  UA_Int32 highestfd = layer->serversockfd;
27004  for(size_t i = 0; i < layer->mappingsSize; ++i) {
27005  UA_fd_set(layer->mappings[i].sockfd, fdset);
27006  if(layer->mappings[i].sockfd > highestfd)
27007  highestfd = layer->mappings[i].sockfd;
27008  }
27009  return highestfd;
27010 }
27011 
27012 /* callback triggered from the server */
27013 static void
27014 ServerNetworkLayerTCP_closeConnection(UA_Connection *connection) {
27015 #ifdef UA_ENABLE_MULTITHREADING
27016  if(uatomic_xchg(&connection->state, UA_CONNECTION_CLOSED) == UA_CONNECTION_CLOSED)
27017  return;
27018 #else
27019  if(connection->state == UA_CONNECTION_CLOSED)
27020  return;
27021  connection->state = UA_CONNECTION_CLOSED;
27022 #endif
27023 #if UA_LOGLEVEL <= 300
27024  //cppcheck-suppress unreadVariable
27025  ServerNetworkLayerTCP *layer = connection->handle;
27026  UA_LOG_INFO(layer->logger, UA_LOGCATEGORY_NETWORK,
27027  "Connection %i | Force closing the connection",
27028  connection->sockfd);
27029 #endif
27030  /* only "shutdown" here. this triggers the select, where the socket is
27031  "closed" in the mainloop */
27032  shutdown(connection->sockfd, 2);
27033 }
27034 
27035 /* call only from the single networking thread */
27036 static UA_StatusCode
27037 ServerNetworkLayerTCP_add(ServerNetworkLayerTCP *layer, UA_Int32 newsockfd) {
27038  UA_Connection *c = malloc(sizeof(UA_Connection));
27039  if(!c)
27041 
27042  struct sockaddr_in addr;
27043  socklen_t addrlen = sizeof(struct sockaddr_in);
27044  int res = getpeername(newsockfd, (struct sockaddr*)&addr, &addrlen);
27045 
27046  if(res == 0) {
27047  UA_LOG_INFO(layer->logger, UA_LOGCATEGORY_NETWORK,
27048  "Connection %i | New connection over TCP from %s:%d",
27049  newsockfd, inet_ntoa(addr.sin_addr), ntohs(addr.sin_port));
27050  } else {
27051  UA_LOG_WARNING(layer->logger, UA_LOGCATEGORY_NETWORK,
27052  "Connection %i | New connection over TCP, "
27053  "getpeername failed with errno %i", newsockfd, errno);
27054  }
27055 
27056  memset(c, 0, sizeof(UA_Connection));
27057  c->sockfd = newsockfd;
27058  c->handle = layer;
27059  c->localConf = layer->conf;
27060  c->remoteConf = layer->conf;
27061  c->send = socket_write;
27062  c->close = ServerNetworkLayerTCP_closeConnection;
27063  c->getSendBuffer = ServerNetworkLayerGetSendBuffer;
27064  c->releaseSendBuffer = ServerNetworkLayerReleaseSendBuffer;
27065  c->releaseRecvBuffer = ServerNetworkLayerReleaseRecvBuffer;
27067  struct ConnectionMapping *nm;
27068  nm = realloc(layer->mappings,
27069  sizeof(struct ConnectionMapping)*(layer->mappingsSize+1));
27070  if(!nm) {
27071  UA_LOG_ERROR(layer->logger, UA_LOGCATEGORY_NETWORK,
27072  "No memory for a new Connection");
27073  free(c);
27075  }
27076  layer->mappings = nm;
27077  layer->mappings[layer->mappingsSize].connection = c;
27078  layer->mappings[layer->mappingsSize].sockfd = newsockfd;
27079  ++layer->mappingsSize;
27080  return UA_STATUSCODE_GOOD;
27081 }
27082 
27083 static UA_StatusCode
27084 ServerNetworkLayerTCP_start(UA_ServerNetworkLayer *nl, UA_Logger logger) {
27085  ServerNetworkLayerTCP *layer = nl->handle;
27086  layer->logger = logger;
27087 
27088  /* get the discovery url from the hostname */
27090  char hostname[256];
27091  if(gethostname(hostname, 255) == 0) {
27092  char discoveryUrl[256];
27093 #ifndef _MSC_VER
27094  du.length = (size_t)snprintf(discoveryUrl, 255, "opc.tcp://%s:%d",
27095  hostname, layer->port);
27096 #else
27097  du.length = (size_t)_snprintf_s(discoveryUrl, 255, _TRUNCATE,
27098  "opc.tcp://%s:%d", hostname, layer->port);
27099 #endif
27100  du.data = (UA_Byte*)discoveryUrl;
27101  UA_String_copy(&du, &nl->discoveryUrl);
27102  }
27103 
27104  /* Create the server socket */
27105  SOCKET newsock = socket(PF_INET, SOCK_STREAM, 0);
27106 #ifdef _WIN32
27107  if(newsock == INVALID_SOCKET)
27108 #else
27109  if(newsock < 0)
27110 #endif
27111  {
27112  UA_LOG_WARNING(layer->logger, UA_LOGCATEGORY_NETWORK,
27113  "Error opening the server socket");
27115  }
27116 
27117  /* Set socket options */
27118  int optval = 1;
27119  if(setsockopt(newsock, SOL_SOCKET, SO_REUSEADDR,
27120  (const char *)&optval, sizeof(optval)) == -1 ||
27121  socket_set_nonblocking(newsock) != UA_STATUSCODE_GOOD) {
27122  UA_LOG_WARNING(layer->logger, UA_LOGCATEGORY_NETWORK,
27123  "Error during setting of server socket options");
27124  CLOSESOCKET(newsock);
27126  }
27127 
27128  /* Bind socket to address */
27129  const struct sockaddr_in serv_addr = {
27130  .sin_family = AF_INET, .sin_addr.s_addr = INADDR_ANY,
27131  .sin_port = htons(layer->port), .sin_zero = {0}};
27132  if(bind(newsock, (const struct sockaddr *)&serv_addr, sizeof(serv_addr)) < 0) {
27133  UA_LOG_WARNING(layer->logger, UA_LOGCATEGORY_NETWORK,
27134  "Error during binding of the server socket");
27135  CLOSESOCKET(newsock);
27137  }
27138 
27139  /* Start listening */
27140  if(listen(newsock, MAXBACKLOG) < 0) {
27141  UA_LOG_WARNING(layer->logger, UA_LOGCATEGORY_NETWORK,
27142  "Error listening on server socket");
27143  CLOSESOCKET(newsock);
27145  }
27146 
27147  layer->serversockfd = (UA_Int32)newsock; /* cast on win32 */
27148  UA_LOG_INFO(layer->logger, UA_LOGCATEGORY_NETWORK,
27149  "TCP network layer listening on %.*s",
27151  return UA_STATUSCODE_GOOD;
27152 }
27153 
27154 static size_t
27155 removeClosedConnections(ServerNetworkLayerTCP *layer, UA_Job *js) {
27156  size_t c = 0;
27157  for(size_t i = 0; i < layer->mappingsSize; ++i) {
27158  if(layer->mappings[i].connection &&
27160  continue;
27161  /* the socket was closed from remote */
27162  UA_Connection *conn = layer->mappings[i].connection;
27163  js[c].type = UA_JOBTYPE_DETACHCONNECTION;
27164  js[c].job.closeConnection = conn;
27165  layer->mappings[i] = layer->mappings[layer->mappingsSize-1];
27166  --layer->mappingsSize;
27167  ++c;
27168  js[c].type = UA_JOBTYPE_METHODCALL_DELAYED;
27169  js[c].job.methodCall.method = FreeConnectionCallback;
27170  js[c].job.methodCall.data = conn;
27171  ++c;
27172  }
27173  return c;
27174 }
27175 
27176 static size_t
27177 ServerNetworkLayerTCP_getJobs(UA_ServerNetworkLayer *nl, UA_Job **jobs,
27178  UA_UInt16 timeout) {
27179  /* Every open socket can generate two jobs */
27180  ServerNetworkLayerTCP *layer = nl->handle;
27181  UA_Job *js = malloc(sizeof(UA_Job) * (size_t)((layer->mappingsSize * 2)));
27182  if(!js)
27184 
27185  /* Remove closed sockets */
27186  size_t totalJobs = removeClosedConnections(layer, js);
27187 
27188  /* Listen on open sockets (including the server) */
27189  fd_set fdset, errset;
27190  UA_Int32 highestfd = setFDSet(layer, &fdset);
27191  setFDSet(layer, &errset);
27192  struct timeval tmptv = {0, timeout * 1000};
27193  UA_Int32 resultsize = select(highestfd+1, &fdset, NULL, &errset, &tmptv);
27194  if(totalJobs == 0 && resultsize <= 0) {
27195  free(js);
27196  *jobs = NULL;
27197  return 0;
27198  }
27199 
27200  /* Accept new connection via the server socket (can only be a single one) */
27201  if(UA_fd_isset(layer->serversockfd, &fdset)) {
27202  --resultsize;
27203  SOCKET newsockfd = accept((SOCKET)layer->serversockfd, NULL, NULL);
27204 #ifdef _WIN32
27205  if(newsockfd != INVALID_SOCKET)
27206 #else
27207  if(newsockfd >= 0)
27208 #endif
27209  {
27210  socket_set_nonblocking(newsockfd);
27211  /* Do not merge packets on the socket (disable Nagle's algorithm) */
27212  int i = 1;
27213  setsockopt(newsockfd, IPPROTO_TCP, TCP_NODELAY, (void *)&i, sizeof(i));
27214  ServerNetworkLayerTCP_add(layer, (UA_Int32)newsockfd);
27215  }
27216  }
27217 
27218  /* Read from established sockets */
27220  size_t j = 0;
27221  for(size_t i = 0; i < layer->mappingsSize && j < (size_t)resultsize; ++i) {
27222  if(!UA_fd_isset(layer->mappings[i].sockfd, &errset) &&
27223  !UA_fd_isset(layer->mappings[i].sockfd, &fdset))
27224  continue;
27225 
27226  UA_StatusCode retval = socket_recv(layer->mappings[i].connection, &buf, 0);
27227  if(retval == UA_STATUSCODE_GOOD) {
27228  js[totalJobs + j].job.binaryMessage.connection = layer->mappings[i].connection;
27229  js[totalJobs + j].job.binaryMessage.message = buf;
27230  js[totalJobs + j].type = UA_JOBTYPE_BINARYMESSAGE_NETWORKLAYER;
27231  ++j;
27232  } else if (retval == UA_STATUSCODE_BADCONNECTIONCLOSED) {
27233  UA_Connection *c = layer->mappings[i].connection;
27234  UA_LOG_INFO(layer->logger, UA_LOGCATEGORY_NETWORK,
27235  "Connection %i | Connection closed from remote", c->sockfd);
27236  /* the socket was closed from remote */
27237  js[totalJobs + j].type = UA_JOBTYPE_DETACHCONNECTION;
27238  js[totalJobs + j].job.closeConnection = c;
27239  layer->mappings[i] = layer->mappings[layer->mappingsSize-1];
27240  --layer->mappingsSize;
27241  ++totalJobs; /* increase j only once */
27242  js[totalJobs + j].type = UA_JOBTYPE_METHODCALL_DELAYED;
27243  js[totalJobs + j].job.methodCall.method = FreeConnectionCallback;
27244  js[totalJobs + j].job.methodCall.data = c;
27245  ++j;
27246  }
27247  }
27248  totalJobs += j;
27249 
27250  if(totalJobs == 0) {
27251  free(js);
27252  js = NULL;
27253  }
27254  *jobs = js;
27255  return totalJobs;
27256 }
27257 
27258 static size_t
27259 ServerNetworkLayerTCP_stop(UA_ServerNetworkLayer *nl, UA_Job **jobs) {
27260  ServerNetworkLayerTCP *layer = nl->handle;
27261  UA_LOG_INFO(layer->logger, UA_LOGCATEGORY_NETWORK,
27262  "Shutting down the TCP network layer with %d open connection(s)",
27263  layer->mappingsSize);
27264  shutdown((SOCKET)layer->serversockfd,2);
27265  CLOSESOCKET(layer->serversockfd);
27266  UA_Job *items = malloc(sizeof(UA_Job) * layer->mappingsSize * 2);
27267  if(!items)
27268  return 0;
27269  for(size_t i = 0; i < layer->mappingsSize; ++i) {
27270  socket_close(layer->mappings[i].connection);
27271  items[i*2].type = UA_JOBTYPE_DETACHCONNECTION;
27272  items[i*2].job.closeConnection = layer->mappings[i].connection;
27273  items[(i*2)+1].type = UA_JOBTYPE_METHODCALL_DELAYED;
27274  items[(i*2)+1].job.methodCall.method = FreeConnectionCallback;
27275  items[(i*2)+1].job.methodCall.data = layer->mappings[i].connection;
27276  }
27277 #ifdef _WIN32
27278  WSACleanup();
27279 #endif
27280  *jobs = items;
27281  return layer->mappingsSize*2;
27282 }
27283 
27284 /* run only when the server is stopped */
27285 static void ServerNetworkLayerTCP_deleteMembers(UA_ServerNetworkLayer *nl) {
27286  ServerNetworkLayerTCP *layer = nl->handle;
27287  free(layer->mappings);
27288  free(layer);
27289  UA_String_deleteMembers(&nl->discoveryUrl);
27290 }
27291 
27294 #ifdef _WIN32
27295  WORD wVersionRequested;
27296  WSADATA wsaData;
27297  wVersionRequested = MAKEWORD(2, 2);
27298  WSAStartup(wVersionRequested, &wsaData);
27299 #endif
27300 
27302  memset(&nl, 0, sizeof(UA_ServerNetworkLayer));
27303  ServerNetworkLayerTCP *layer = calloc(1,sizeof(ServerNetworkLayerTCP));
27304  if(!layer)
27305  return nl;
27306 
27307  layer->conf = conf;
27308  layer->port = port;
27309 
27310  nl.handle = layer;
27311  nl.start = ServerNetworkLayerTCP_start;
27312  nl.getJobs = ServerNetworkLayerTCP_getJobs;
27313  nl.stop = ServerNetworkLayerTCP_stop;
27314  nl.deleteMembers = ServerNetworkLayerTCP_deleteMembers;
27315  return nl;
27316 }
27317 
27318 /***************************/
27319 /* Client NetworkLayer TCP */
27320 /***************************/
27321 
27322 static UA_StatusCode
27323 ClientNetworkLayerGetBuffer(UA_Connection *connection, size_t length,
27324  UA_ByteString *buf) {
27325  if(length > connection->remoteConf.recvBufferSize)
27327  if(connection->state == UA_CONNECTION_CLOSED)
27329  return UA_ByteString_allocBuffer(buf, connection->remoteConf.recvBufferSize);
27330 }
27331 
27332 static void
27333 ClientNetworkLayerReleaseBuffer(UA_Connection *connection, UA_ByteString *buf) {
27334  UA_ByteString_deleteMembers(buf);
27335 }
27336 
27337 static void
27338 ClientNetworkLayerClose(UA_Connection *connection) {
27339 #ifdef UA_ENABLE_MULTITHREADING
27340  if(uatomic_xchg(&connection->state, UA_CONNECTION_CLOSED) == UA_CONNECTION_CLOSED)
27341  return;
27342 #else
27343  if(connection->state == UA_CONNECTION_CLOSED)
27344  return;
27345  connection->state = UA_CONNECTION_CLOSED;
27346 #endif
27347  socket_close(connection);
27348 }
27349 
27350 /* we have no networklayer. instead, attach the reusable buffer to the handle */
27352 UA_ClientConnectionTCP(UA_ConnectionConfig conf, const char *endpointUrl,
27353  UA_Logger logger) {
27354 #ifdef _WIN32
27355  WORD wVersionRequested;
27356  WSADATA wsaData;
27357  wVersionRequested = MAKEWORD(2, 2);
27358  WSAStartup(wVersionRequested, &wsaData);
27359 #endif
27360 
27361  UA_Connection connection;
27362  memset(&connection, 0, sizeof(UA_Connection));
27363  connection.state = UA_CONNECTION_OPENING;
27364  connection.localConf = conf;
27365  connection.remoteConf = conf;
27366  connection.send = socket_write;
27367  connection.recv = socket_recv;
27368  connection.close = ClientNetworkLayerClose;
27369  connection.getSendBuffer = ClientNetworkLayerGetBuffer;
27370  connection.releaseSendBuffer = ClientNetworkLayerReleaseBuffer;
27371  connection.releaseRecvBuffer = ClientNetworkLayerReleaseBuffer;
27372 
27373  char hostname[512];
27374  UA_UInt16 port = 0;
27375  const char *path = NULL;
27376 
27377  UA_StatusCode parse_retval = UA_EndpointUrl_split(endpointUrl, hostname, &port, &path);
27378  if(parse_retval != UA_STATUSCODE_GOOD) {
27379  if(parse_retval == UA_STATUSCODE_BADOUTOFRANGE)
27380  UA_LOG_WARNING(logger, UA_LOGCATEGORY_NETWORK,
27381  "Server url is invalid: %s", endpointUrl);
27382  else if(parse_retval == UA_STATUSCODE_BADATTRIBUTEIDINVALID)
27383  UA_LOG_WARNING(logger, UA_LOGCATEGORY_NETWORK,
27384  "Server url does not begin with 'opc.tcp://' '%s'",
27385  endpointUrl);
27386  return connection;
27387  }
27388 
27389  if(port == 0) {
27390  port = 4840;
27391  UA_LOG_INFO(logger, UA_LOGCATEGORY_NETWORK,
27392  "No port defined, using standard port %d", port);
27393  }
27394 
27395  struct addrinfo hints, *server;
27396  memset(&hints, 0, sizeof(hints));
27397  hints.ai_socktype = SOCK_STREAM;
27398  hints.ai_family = AF_INET;
27399  char portStr[6];
27400 #ifndef _MSC_VER
27401  snprintf(portStr, 6, "%d", port);
27402 #else
27403  _snprintf_s(portStr, 6, _TRUNCATE, "%d", port);
27404 #endif
27405  int error = getaddrinfo(hostname, portStr, &hints, &server);
27406  if(error != 0 || !server) {
27407  UA_LOG_WARNING(logger, UA_LOGCATEGORY_NETWORK,
27408  "DNS lookup of %s failed with error %s",
27409  hostname, gai_strerror(error));
27410  return connection;
27411  }
27412 
27413  /* Get a socket */
27414  SOCKET clientsockfd = socket(server->ai_family, server->ai_socktype,
27415  server->ai_protocol);
27416 #ifdef _WIN32
27417  if(clientsockfd == INVALID_SOCKET) {
27418 #else
27419  if(clientsockfd < 0) {
27420 #endif
27421  UA_LOG_WARNING(logger, UA_LOGCATEGORY_NETWORK,
27422  "Could not create client socket");
27423  freeaddrinfo(server);
27424  return connection;
27425  }
27426 
27427  /* Connect to the server */
27428  connection.sockfd = (UA_Int32)clientsockfd; /* cast for win32 */
27429  error = connect(clientsockfd, server->ai_addr, WIN32_INT server->ai_addrlen);
27430  freeaddrinfo(server);
27431  if(error < 0) {
27432  ClientNetworkLayerClose(&connection);
27433 #ifdef _WIN32
27434  wchar_t *s = NULL;
27435  FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER |
27436  FORMAT_MESSAGE_FROM_SYSTEM |
27437  FORMAT_MESSAGE_IGNORE_INSERTS,
27438  NULL, WSAGetLastError(),
27439  MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
27440  (LPWSTR)&s, 0, NULL);
27441  UA_LOG_DEBUG(logger, UA_LOGCATEGORY_NETWORK,
27442  "Connection to %s failed. Error: %d: %S",
27443  endpointUrl, WSAGetLastError(), s);
27444  LocalFree(s);
27445 #else
27446  UA_LOG_DEBUG(logger, UA_LOGCATEGORY_NETWORK,
27447  "Connection to %s failed. Error: %d: %s",
27448  endpointUrl, errno, strerror(errno));
27449 #endif
27450  return connection;
27451  }
27452 
27453 #ifdef SO_NOSIGPIPE
27454  int val = 1;
27455  int sso_result = setsockopt(connection.sockfd,
27456  SOL_SOCKET, SO_NOSIGPIPE,
27457  (void*)&val, sizeof(val));
27458  if(sso_result < 0)
27459  UA_LOG_WARNING(logger, UA_LOGCATEGORY_NETWORK,
27460  "Couldn't set SO_NOSIGPIPE");
27461 #endif
27462 
27463  return connection;
27464 }
27465 
27466 /*********************************** amalgamated original file "/home/iosb/sw/open62541/plugins/ua_clock.c" ***********************************/
27467 
27468 /* This work is licensed under a Creative Commons CCZero 1.0 Universal License.
27469  * See http://creativecommons.org/publicdomain/zero/1.0/ for more information. */
27470 
27471 
27472 #include <time.h>
27473 #ifdef _WIN32
27474 # ifdef SLIST_ENTRY
27475 # undef SLIST_ENTRY /* Fix redefinition of SLIST_ENTRY on mingw winnt.h */
27476 # endif
27477 # include <windows.h>
27478 #else
27479 # include <sys/time.h>
27480 #endif
27481 
27482 #if defined(__APPLE__) || defined(__MACH__)
27483 # include <mach/clock.h>
27484 # include <mach/mach.h>
27485 #endif
27486 
27488 #if defined(_WIN32)
27489  /* Windows filetime has the same definition as UA_DateTime */
27490  FILETIME ft;
27491  SYSTEMTIME st;
27492  GetSystemTime(&st);
27493  SystemTimeToFileTime(&st, &ft);
27494  ULARGE_INTEGER ul;
27495  ul.LowPart = ft.dwLowDateTime;
27496  ul.HighPart = ft.dwHighDateTime;
27497  return (UA_DateTime)ul.QuadPart;
27498 #else
27499  struct timeval tv;
27500  gettimeofday(&tv, NULL);
27501  return (tv.tv_sec * UA_SEC_TO_DATETIME) + (tv.tv_usec * UA_USEC_TO_DATETIME) + UA_DATETIME_UNIX_EPOCH;
27502 #endif
27503 }
27504 
27506 #if defined(_WIN32)
27507  LARGE_INTEGER freq, ticks;
27508  QueryPerformanceFrequency(&freq);
27509  QueryPerformanceCounter(&ticks);
27510  UA_Double ticks2dt = UA_SEC_TO_DATETIME / (UA_Double)freq.QuadPart;
27511  return (UA_DateTime)(ticks.QuadPart * ticks2dt);
27512 #elif defined(__APPLE__) || defined(__MACH__)
27513  /* OS X does not have clock_gettime, use clock_get_time */
27514  clock_serv_t cclock;
27515  mach_timespec_t mts;
27516  host_get_clock_service(mach_host_self(), SYSTEM_CLOCK, &cclock);
27517  clock_get_time(cclock, &mts);
27518  mach_port_deallocate(mach_task_self(), cclock);
27519  return (mts.tv_sec * UA_SEC_TO_DATETIME) + (mts.tv_nsec / 100);
27520 #elif !defined(CLOCK_MONOTONIC_RAW)
27521  struct timespec ts;
27522  clock_gettime(CLOCK_MONOTONIC, &ts);
27523  return (ts.tv_sec * UA_SEC_TO_DATETIME) + (ts.tv_nsec / 100);
27524 #else
27525  struct timespec ts;
27526  clock_gettime(CLOCK_MONOTONIC_RAW, &ts);
27527  return (ts.tv_sec * UA_SEC_TO_DATETIME) + (ts.tv_nsec / 100);
27528 #endif
27529 }
27530 
27531 /*********************************** amalgamated original file "/home/iosb/sw/open62541/plugins/ua_log_stdout.c" ***********************************/
27532 
27533 /* This work is licensed under a Creative Commons CCZero 1.0 Universal License.
27534  * See http://creativecommons.org/publicdomain/zero/1.0/ for more information. */
27535 
27536 #include <stdio.h>
27537 #include <stdarg.h>
27538 
27539 #ifdef UA_ENABLE_MULTITHREADING
27540 #include <pthread.h>
27541 static pthread_mutex_t printf_mutex = PTHREAD_MUTEX_INITIALIZER;
27542 #endif
27543 
27544 const char *LogLevelNames[6] = {"trace", "debug", "info", "warning", "error", "fatal"};
27545 const char *LogCategoryNames[6] = {"network", "channel", "session", "server", "client", "userland"};
27546 
27547 #if (defined(__GNUC__) && defined(__GNUC_MINOR__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 6) || \
27548  defined(__clang__)
27549 # pragma GCC diagnostic push
27550 # pragma GCC diagnostic ignored "-Wformat-nonliteral"
27551 #endif
27552 
27553 void
27555  const char *msg, va_list args) {
27557 #ifdef UA_ENABLE_MULTITHREADING
27558  pthread_mutex_lock(&printf_mutex);
27559 #endif
27560  printf("[%.23s] %s/%s\t", t.data, LogLevelNames[level], LogCategoryNames[category]);
27561  vprintf(msg, args);
27562  printf("\n");
27563  fflush(stdout);
27564 #ifdef UA_ENABLE_MULTITHREADING
27565  pthread_mutex_unlock(&printf_mutex);
27566 #endif
27567  UA_ByteString_deleteMembers(&t);
27568 }
27569 
27570 #if (defined(__GNUC__) && defined(__GNUC_MINOR__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 6) || \
27571  defined(__clang__)
27572 # pragma GCC diagnostic pop
27573 #endif
27574 
27575 /*********************************** amalgamated original file "/home/iosb/sw/open62541/plugins/ua_config_standard.c" ***********************************/
27576 
27577 /* This work is licensed under a Creative Commons CCZero 1.0 Universal License.
27578  * See http://creativecommons.org/publicdomain/zero/1.0/ for more information. */
27579 
27580 
27581 /*******************************/
27582 /* Default Connection Settings */
27583 /*******************************/
27584 
27586  .protocolVersion = 0,
27587  .sendBufferSize = 65535, /* 64k per chunk */
27588  .recvBufferSize = 65535, /* 64k per chunk */
27589  .maxMessageSize = 0, /* 0 -> unlimited */
27590  .maxChunkCount = 0 /* 0 -> unlimited */
27591 };
27592 
27593 /***************************/
27594 /* Default Server Settings */
27595 /***************************/
27596 
27597 #define MANUFACTURER_NAME "open62541"
27598 #define PRODUCT_NAME "open62541 OPC UA Server"
27599 #define PRODUCT_URI "http://open62541.org"
27600 #define APPLICATION_NAME "open62541-based OPC UA Application"
27601 #define APPLICATION_URI "urn:unconfigured:application"
27602 
27603 #define UA_STRING_STATIC(s) {sizeof(s)-1, (UA_Byte*)s}
27604 #define UA_STRING_STATIC_NULL {0, NULL}
27605 
27606 #define STRINGIFY(arg) #arg
27607 #define VERSION(MAJOR, MINOR, PATCH, LABEL) \
27608  STRINGIFY(MAJOR) "." STRINGIFY(MINOR) "." STRINGIFY(PATCH) LABEL
27609 
27611  { UA_STRING_STATIC("user1"), UA_STRING_STATIC("password") },
27612  { UA_STRING_STATIC("user2"), UA_STRING_STATIC("password1") } };
27613 
27615  .nThreads = 1,
27616  .logger = UA_Log_Stdout,
27617 
27618  /* Server Description */
27619  .buildInfo = {
27620  .productUri = UA_STRING_STATIC(PRODUCT_URI),
27621  .manufacturerName = UA_STRING_STATIC(MANUFACTURER_NAME),
27622  .productName = UA_STRING_STATIC(PRODUCT_NAME),
27623  .softwareVersion = UA_STRING_STATIC(VERSION(UA_OPEN62541_VER_MAJOR,
27627  .buildNumber = UA_STRING_STATIC(__DATE__ " " __TIME__),
27628  .buildDate = 0 },
27629  .applicationDescription = {
27630  .applicationUri = UA_STRING_STATIC(APPLICATION_URI),
27631  .productUri = UA_STRING_STATIC(PRODUCT_URI),
27632  .applicationName = { .locale = UA_STRING_STATIC("en"),
27634  .applicationType = UA_APPLICATIONTYPE_SERVER,
27635  .gatewayServerUri = UA_STRING_STATIC_NULL,
27636  .discoveryProfileUri = UA_STRING_STATIC_NULL,
27637  .discoveryUrlsSize = 0,
27638  .discoveryUrls = NULL },
27639  .serverCertificate = UA_STRING_STATIC_NULL,
27640 
27641  /* Networking */
27642  .networkLayersSize = 0,
27643  .networkLayers = NULL,
27644 
27645  /* Login */
27646  .enableAnonymousLogin = true,
27647  .enableUsernamePasswordLogin = true,
27648  .usernamePasswordLogins = usernamePasswords,
27649  .usernamePasswordLoginsSize = 2,
27650 
27651  /* Limits for SecureChannels */
27652  .maxSecureChannels = 40,
27653  .maxSecurityTokenLifetime = 10 * 60 * 1000, /* 10 minutes */
27654 
27655  /* Limits for Sessions */
27656  .maxSessions = 100,
27657  .maxSessionTimeout = 60.0 * 60.0 * 1000.0, /* 1h */
27658 
27659  /* Limits for Subscriptions */
27660  .publishingIntervalLimits = { .min = 100.0, .max = 3600.0 * 1000.0 },
27661  .lifeTimeCountLimits = { .max = 15000, .min = 3 },
27662  .keepAliveCountLimits = { .max = 100, .min = 1 },
27663  .maxNotificationsPerPublish = 1000,
27664  .maxRetransmissionQueueSize = 0, /* unlimited */
27665 
27666  /* Limits for MonitoredItems */
27667  .samplingIntervalLimits = { .min = 50.0, .max = 24.0 * 3600.0 * 1000.0 },
27668  .queueSizeLimits = { .max = 100, .min = 1 }
27669 };
27670 
27671 /***************************/
27672 /* Default Client Settings */
27673 /***************************/
27674 
27675 const UA_EXPORT UA_ClientConfig UA_ClientConfig_standard = {
27676  .timeout = 5000, /* 5 seconds */
27677  .secureChannelLifeTime = 10 * 60 * 1000, /* 10 minutes */
27678  .logger = UA_Log_Stdout,
27679  .localConnectionConfig = {
27680  .protocolVersion = 0,
27681  .sendBufferSize = 65535, /* 64k per chunk */
27682  .recvBufferSize = 65535, /* 64k per chunk */
27683  .maxMessageSize = 0, /* 0 -> unlimited */
27684  .maxChunkCount = 0 /* 0 -> unlimited */
27685  },
27686  .connectionFunc = UA_ClientConnectionTCP
27687 };
27688 /****************************************/
27689 /* Default Client Subscription Settings */
27690 /****************************************/
27691 
27692 #ifdef UA_ENABLE_SUBSCRIPTIONS
27693 
27694 const UA_SubscriptionSettings UA_SubscriptionSettings_standard = {
27695  .requestedPublishingInterval = 500.0,
27696  .requestedLifetimeCount = 10000,
27697  .requestedMaxKeepAliveCount = 1,
27698  .maxNotificationsPerPublish = 10,
27699  .publishingEnabled = true,
27700  .priority = 0
27701 };
27702 
27703 #endif
UA_Int32 i32
Definition: open62541.c:778
UA_EndpointDescription * serverEndpoints
Definition: open62541.h:5159
UA_String * profileUris
Definition: open62541.h:4470
UA_SecureChannel * channel
Definition: open62541.h:9482
#define UA_NS0ID_BROWSENEXTREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2131
#define LIST_HEAD(name, type)
Definition: open62541.c:197
#define UA_NS0ID_SERVER_SERVERCAPABILITIES_MAXQUERYCONTINUATIONPOINTS
Definition: open62541.h:2612
#define UA_NS0ID_UNREGISTERNODESREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2164
UA_StatusCode UA_Server_addReference(UA_Server *server, const UA_NodeId sourceId, const UA_NodeId refTypeId, const UA_ExpandedNodeId targetId, UA_Boolean isForward)
Definition: open62541.c:22342
void Service_TranslateBrowsePathsToNodeIds(UA_Server *server, UA_Session *session, const UA_TranslateBrowsePathsToNodeIdsRequest *request, UA_TranslateBrowsePathsToNodeIdsResponse *response)
Definition: open62541.c:23274
UA_StatusCode UA_Client_connect_username(UA_Client *client, const char *endpointUrl, const char *username, const char *password)
Definition: open62541.c:25289
UA_ResponseHeader responseHeader
Definition: open62541.h:4630
UA_NodeId authenticationToken
Definition: open62541.c:4755
#define UA_NS0ID_SERVERTYPE
Definition: open62541.h:2488
#define UA_STATUSCODE_BADSHELVINGTIMEOUTOFRANGE
Definition: open62541.h:835
UA_TimestampsToReturn timestampsToReturn
Definition: open62541.h:4531
#define UA_NS0ID_MODIFYMONITOREDITEMSREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2361
WriteValue ^^^^^^^^^^.
Definition: open62541.h:3632
UA_StatusCode(* recv)(UA_Connection *connection, UA_ByteString *response, UA_UInt32 timeout)
Definition: open62541.h:9516
size_t continuationPointsSize
Definition: open62541.h:4217
#define UA_TYPES_SETMONITORINGMODERESPONSE
Definition: open62541.h:4550
UA_VariantStorageType storageType
Definition: open62541.h:1401
UA_SecureChannelManager secureChannelManager
Definition: open62541.c:4219
void UA_Variant_setScalar(UA_Variant *v, void *UA_RESTRICT p, const UA_DataType *type)
Definition: open62541.c:5168
#define UA_STATUSCODE_BADDEADBANDFILTERINVALID
Definition: open62541.h:814
#define UA_STATUSCODE_UNCERTAININITIALVALUE
Definition: open62541.h:818
#define UA_EXPORT
Function Export On Win32: Define UA_DYNAMIC_LINKING and UA_DYNAMIC_LINKING_EXPORT in order to export ...
Definition: open62541.h:143
#define FLOAT_NEG_ZERO
Definition: open62541.c:6179
UA_UInt32 requestHandle
Definition: open62541.h:3303
#define UA_NodeStore_newVariableTypeNode()
Definition: open62541.c:3996
#define UA_STATUSCODE_BADVIEWPARAMETERMISMATCH
Definition: open62541.h:771
UA_Byte eventNotifier
Definition: open62541.h:3270
#define UA_NS0ID_ENUMERATION
Definition: open62541.h:1824
UA_Boolean symmetric
Definition: open62541.c:3656
SequenceHeader ^^^^^^^^^^^^^^ Secure Layer Sequence Header.
Definition: open62541.c:2617
struct UA_ExtensionObject::@1::@2 encoded
uint32_t UA_UInt32
UInt32 ^^^^^^ An integer value between 0 and 4 294 967 295.
Definition: open62541.h:970
#define UA_TYPES_METHODATTRIBUTES
Definition: open62541.h:3612
size_t arrayLength
Definition: open62541.h:1402
#define UA_BINARY_OVERLAYABLE_INTEGER
String Manipulation The header string.h is defined in the C-standard.
Definition: open62541.h:247
#define UA_STATUSCODE_BADDEVICEFAILURE
Definition: open62541.h:811
UA_Session adminSession
Definition: open62541.c:15619
#define UA_NS0ID_FROMSTATE
Definition: open62541.h:1843
void UA_SecureChannel_revolveTokens(UA_SecureChannel *channel)
Definition: open62541.c:15262
UA_UInt32 maxMessageSize
Definition: open62541.c:2552
#define UA_NS0ID_SERVERSTATUSDATATYPE
Definition: open62541.h:2448
#define UA_TYPES_SIGNATUREDATA
Definition: open62541.h:3693
UA_ResponseHeader responseHeader
Definition: open62541.h:4934
#define UA_STATUSCODE_BADINSUFFICIENTCLIENTPROFILE
Definition: open62541.h:794
UA_QualifiedName targetName
Definition: open62541.h:3477
#define UA_STATUSCODE_BADEVENTFILTERINVALID
Definition: open62541.h:726
#define UA_NS0ID_BUILDINFO
Definition: open62541.h:1958
Definition: open62541.c:3709
#define container_of(ptr, type, member)
Definition: open62541.c:749
UA_StatusCode UA_Server_forEachChildNodeCall(UA_Server *server, UA_NodeId parentNodeId, UA_NodeIteratorCallback callback, void *handle)
Definition: open62541.c:15795
ApplicationDescription ^^^^^^^^^^^^^^^^^^^^^^ Describes an application and how to find it...
Definition: open62541.h:4906
#define UA_NS0ID_SERVER_VENDORSERVERINFO
Definition: open62541.h:2572
void Service_DeleteNodes(UA_Server *server, UA_Session *session, const UA_DeleteNodesRequest *request, UA_DeleteNodesResponse *response)
Definition: open62541.c:22400
UA_LogCategory
Definition: open62541.h:9639
UA_NodeId referenceTypeId
Definition: open62541.h:3474
UA_BrowsePathResult UA_Server_translateBrowsePathToNodeIds(UA_Server *server, const UA_BrowsePath *browsePath)
Definition: open62541.c:23264
#define NULL
size_t resultsSize
Definition: open62541.h:4202
#define UA_NS0ID_FINDSERVERSREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2020
#define UA_TYPES_QUERYDATASET
Definition: open62541.h:3546
#define UA_OPEN62541_VER_LABEL
Definition: open62541.h:42
#define UA_STATUSCODE_BADSERVERNOTCONNECTED
Definition: open62541.h:666
#define UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO_MANUFACTURERNAME
Definition: open62541.h:2547
TcpMessageHeader ^^^^^^^^^^^^^^^^ TCP Header.
Definition: open62541.c:2628
#define UA_NS0ID_ORGANIZES
Definition: open62541.h:1830
#define UA_STATUSCODE_UNCERTAINDATASUBNORMAL
Definition: open62541.h:846
UA_ApplicationType
ApplicationType ^^^^^^^^^^^^^^^ The types of applications.
Definition: open62541.h:4097
const UA_EXPORT UA_ConnectionConfig UA_ConnectionConfig_standard
Definition: open62541.c:27585
UA_StatusCode UA_NodeStore_remove(UA_NodeStore *ns, const UA_NodeId *nodeid)
Definition: open62541.c:19471
UA_MonitoredItemNotification * monitoredItems
Definition: open62541.h:4507
#define UA_STATUSCODE_GOODDATAIGNORED
Definition: open62541.h:853
#define UA_STATUSCODE_BADENCODINGERROR
Definition: open62541.h:657
#define UA_TYPES_DELETEMONITOREDITEMSREQUEST
Definition: open62541.h:4363
UA_UInt16 typeIndex
Definition: open62541.h:1656
#define UA_TYPES_SETPUBLISHINGMODEREQUEST
Definition: open62541.h:3569
void UA_Subscription_publishCallback(UA_Server *server, UA_Subscription *sub)
#define UA_TYPES_MODIFYMONITOREDITEMSREQUEST
Definition: open62541.h:4536
#define UA_STATUSCODE_BADCERTIFICATEINVALID
Definition: open62541.h:672
UA_ByteString incompleteMessage
Definition: open62541.h:9488
#define UA_TYPES_DELETEREFERENCESITEM
Definition: open62541.h:3626
UA_Variant value
Definition: open62541.h:1574
#define APPLICATION_NAME
Definition: open62541.c:27600
void(* UA_Service)(UA_Server *, UA_Session *, const void *request, void *response)
Definition: open62541.c:4406
UA_StatusCode innerStatusCode
Definition: open62541.h:1600
UA_NodeStore * UA_NodeStore_new(void)
Nodestore Lifecycle ^^^^^^^^^^^^^^^^^^^.
Definition: open62541.c:19346
UA_String endpointUrl
Definition: open62541.c:2554
#define UA_TYPES_SIGNEDSOFTWARECERTIFICATE
Definition: open62541.h:3246
#define STARTTOKENID
Definition: open62541.c:18641
#define LIST_NEXT(elm, field)
Definition: open62541.c:217
UA_AddNodesItem * nodesToAdd
Definition: open62541.h:4991
UA_MonitoredItem * UA_MonitoredItem_new(void)
UA_Boolean UA_Guid_equal(const UA_Guid *g1, const UA_Guid *g2)
Definition: open62541.c:4917
AddReferencesItem ^^^^^^^^^^^^^^^^^ A request to add a reference to the server address space...
Definition: open62541.h:4614
UA_StatusCode UA_SecureChannelManager_close(UA_SecureChannelManager *cm, UA_UInt32 channelId)
Definition: open62541.c:18812
#define UA_TYPES_READVALUEID
Definition: open62541.h:3880
#define UA_TYPES_BROWSEPATH
Definition: open62541.h:5019
UA_UInt32 requestId
Definition: open62541.c:3224
UA_String username
Definition: open62541.c:4750
UA_Boolean containsNoLoops
Definition: open62541.c:3691
UA_ByteString serverCertificate
Definition: open62541.h:5071
void UA_Client_reset(UA_Client *client)
Definition: open62541.c:24734
#define UA_NS0ID_REFERENCETYPESFOLDER
Definition: open62541.h:1869
UA_DateTime publishTime
Definition: open62541.h:3375
UA_StatusCode statusCode
Definition: open62541.h:5026
UA_NODE_BASEATTRIBUTES UA_Boolean isAbstract
Definition: open62541.c:3655
RelativePath ^^^^^^^^^^^^ A relative path constructed from reference types and browse names...
Definition: open62541.h:4657
UA_TcpMessageHeader messageHeader
Definition: open62541.c:2664
TranslateBrowsePathsToNodeIdsRequest ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Translates one or more path...
Definition: open62541.h:5125
UA_UInt32 size
Definition: open62541.c:19182
UA_QualifiedName browseName
Definition: open62541.h:4817
#define UA_STATUSCODE_BADCONDITIONALREADYDISABLED
Definition: open62541.h:824
struct UA_NodeStoreEntry * orig
Definition: open62541.c:19174
UA_DeleteNodesItem * nodesToDelete
Definition: open62541.h:3984
#define UA_STATUSCODE_BADDUPLICATEREFERENCENOTALLOWED
Definition: open62541.h:763
#define UA_STATUSCODE_UNCERTAINREFERENCENOTDELETED
Definition: open62541.h:767
UA_String UA_ByteString
ByteString ^^^^^^^^^^ A sequence of octets.
Definition: open62541.h:1122
#define UA_STATUSCODE_BADINDEXRANGEINVALID
Definition: open62541.h:709
UA_Byte data4[8]
Definition: open62541.h:1111
#define UA_NS0ID_QUALIFIEDNAME
Definition: open62541.h:1815
size_t namespacesSize
Definition: open62541.c:4225
UA_StatusCode UA_Client_manuallyRenewSecureChannel(UA_Client *client)
Definition: open62541.c:25358
UA_LogLevel
Logging
Definition: open62541.h:9630
UA_NodeId dataType
Definition: open62541.h:3713
UA_StatusCode Subscription_unregisterPublishJob(UA_Server *server, UA_Subscription *sub)
#define UA_STATUSCODE_BADCERTIFICATEUNTRUSTED
Definition: open62541.h:680
void(* UA_deleteMembersSignature)(void *p, const UA_DataType *type)
Definition: open62541.c:5694
CreateSessionRequest ^^^^^^^^^^^^^^^^^^^^ Creates a new session with the server.
Definition: open62541.h:5038
UA_String securityPolicyUri
Definition: open62541.h:4347
size_t resultsSize
Definition: open62541.h:4775
UA_UInt32 userWriteMask
Definition: open62541.h:3960
void UA_Server_deleteAllRepeatedJobs(UA_Server *server)
Definition: open62541.c:18275
#define UA_NS0ID_OBJECTSFOLDER
Definition: open62541.h:1863
#define MAXBACKLOG
For the multithreaded mode, assume a single thread that periodically "gets work" from the network lay...
Definition: open62541.c:26965
struct UA_ExtensionObject::@1::@3 decoded
#define UA_STATUSCODE_BADCONTINUATIONPOINTINVALID
Definition: open62541.h:734
QueryFirstRequest ^^^^^^^^^^^^^^^^^.
Definition: open62541.h:5172
#define UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO_SOFTWAREVERSION
Definition: open62541.h:2548
#define UA_NS0ID_BOOLEAN
Definition: open62541.h:1796
UA_StatusCode UA_Server_editNode(UA_Server *server, UA_Session *session, const UA_NodeId *nodeId, UA_EditNodeCallback callback, const void *data)
Definition: open62541.c:17904
#define UA_TYPES_GUID
Guid ^^^^.
Definition: open62541.h:3169
#define UA_STATUSCODE_BADCONDITIONDISABLED
Definition: open62541.h:826
FindServersRequest ^^^^^^^^^^^^^^^^^^ Finds the servers known to the discovery server.
Definition: open62541.h:4556
#define UA_NS0ID_TRANSLATEBROWSEPATHSTONODEIDSREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2152
#define MAX_PICO_SECONDS
Definition: open62541.c:7037
UA_ResponseHeader responseHeader
Definition: open62541.h:4085
#define UA_STATUSCODE_BADOUTOFSERVICE
Definition: open62541.h:813
#define TAILQ_REMOVE(head, elm, field)
Definition: open62541.c:526
AddNodesItem ^^^^^^^^^^^^ A request to add a node to the server address space.
Definition: open62541.h:4813
#define UA_STATUSCODE_BADCONNECTIONREJECTED
Definition: open62541.h:867
SymmetricAlgorithmSecurityHeader ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Secure Layer Symmetric Algorithm He...
Definition: open62541.c:2653
#define UA_RCU_UNLOCK()
Definition: open62541.c:4190
UA_SecureChannel channel
Definition: open62541.c:4108
struct ServerNetworkLayerTCP::ConnectionMapping * mappings
UA_ExtensionObjectEncoding encoding
Definition: open62541.h:1548
UA_ByteString continuationPoint
Definition: open62541.h:5027
void UA_Server_processBinaryMessage(UA_Server *server, UA_Connection *connection, const UA_ByteString *message)
Definition: open62541.c:17584
#define UA_NodeStore_newObjectTypeNode()
Definition: open62541.c:3994
#define CHECK_NODECLASS(CLASS)
Definition: open62541.c:20710
CreateMonitoredItemsRequest ^^^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4945
struct UA_Job::@5::@6 binaryMessage
#define TAILQ_FOREACH(var, head, field)
Definition: open62541.c:461
UA_StatusCode UA_Client_NamespaceGetIndex(UA_Client *client, UA_String *namespaceUri, UA_UInt16 *namespaceIndex)
Definition: open62541.c:25533
#define CHECK_DATATYPE_ARRAY(EXP_DT)
Definition: open62541.c:21021
ServiceFault ^^^^^^^^^^^^ The response returned by all services when there is a service level error...
Definition: open62541.h:4923
#define UA_NS0ID_CREATESESSIONREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2059
#define UA_TRANSPORT_TCPACKNOWLEDGEMESSAGE
Definition: open62541.c:2611
#define UA_STATUSCODE_BADDISCONNECT
Definition: open62541.h:868
#define UA_NS0ID_VARIABLETYPESFOLDER
Definition: open62541.h:1867
UA_StatusCode UA_SecureChannel_processChunks(UA_SecureChannel *channel, const UA_ByteString *chunks, UA_ProcessMessageCallback callback, void *application)
Definition: open62541.c:15513
#define UA_TYPES_WRITEREQUEST
Definition: open62541.h:4416
UA_CallMethodResult UA_EXPORT UA_Server_call(UA_Server *server, const UA_CallMethodRequest *request)
Method Call
#define UA_STATUSCODE_BADINTERNALERROR
Definition: open62541.h:653
UA_MonitoringMode
MonitoringMode ^^^^^^^^^^^^^^.
Definition: open62541.h:3429
CreateSubscriptionRequest ^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4227
struct UA_MonitoredItem UA_MonitoredItem
UA_ChannelSecurityToken securityToken
Definition: open62541.h:4087
#define UA_TYPES_ACTIVATESESSIONREQUEST
Definition: open62541.h:4078
#define UA_INT32_MAX
Definition: open62541.h:964
#define UA_TYPES_GETENDPOINTSREQUEST
Definition: open62541.h:4473
bool UA_Boolean
Boolean ^^^^^^^ A two-state logical value (true or false).
Definition: open62541.h:922
#define UA_TYPES_DATAVALUE
DataValue ^^^^^^^^^.
Definition: open62541.h:3223
void UA_Client_delete(UA_Client *client)
Definition: open62541.c:24739
#define UA_NS0ID_BASEDATATYPE
Definition: open62541.h:1819
#define UA_STATUSCODE_UNCERTAINREFERENCEOUTOFSERVER
Definition: open62541.h:776
DiagnosticInfo ^^^^^^^^^^^^^^ A structure that contains detailed error and diagnostic information ass...
Definition: open62541.h:1587
#define UA_TYPES_INT16
Int16 ^^^^^.
Definition: open62541.h:3109
#define SIMPLEQ_ENTRY(type)
Definition: open62541.c:289
#define UA_TRANSPORT_TCPHELLOMESSAGE
Definition: open62541.c:2557
UA_DateTime UA_DateTime_now(void)
Definition: open62541.c:27487
DataTypeAttributes ^^^^^^^^^^^^^^^^^^ The attributes for a data type node.
Definition: open62541.h:3886
#define UA_INLINE
Inline Functions
Definition: open62541.h:152
TcpAcknowledgeMessage ^^^^^^^^^^^^^^^^^^^^^ Acknowledge Message.
Definition: open62541.c:2603
UA_StatusCode UA_SessionManager_createSession(UA_SessionManager *sm, UA_SecureChannel *channel, const UA_CreateSessionRequest *request, UA_Session **session)
Definition: open62541.c:18918
#define LEAPOCH
Definition: open62541.c:26324
UA_StatusCode UA_Server_addDataSourceVariableNode(UA_Server *server, const UA_NodeId requestedNewNodeId, const UA_NodeId parentNodeId, const UA_NodeId referenceTypeId, const UA_QualifiedName browseName, const UA_NodeId typeDefinition, const UA_VariableAttributes attr, const UA_DataSource dataSource, UA_NodeId *outNewNodeId)
Definition: open62541.c:22088
UA_StatusCode UA_Client_connect(UA_Client *client, const char *endpointUrl)
Definition: open62541.c:25299
UA_StatusCode UA_Client_disconnect(UA_Client *client)
Definition: open62541.c:25344
const UA_ExpandedNodeId UA_EXPANDEDNODEID_NULL
Definition: open62541.c:4788
#define UA_TYPES_PUBLISHREQUEST
Definition: open62541.h:4485
struct MonitoredItem_queuedValue MonitoredItem_queuedValue
UA_ServerCallback method
Definition: open62541.h:9594
const UA_DataType * responseType
Definition: open62541.c:25374
UA_RelativePathElement * elements
Definition: open62541.h:4659
UA_UInt16 milliSec
Definition: open62541.h:1090
QueryNextRequest ^^^^^^^^^^^^^^^^.
Definition: open62541.h:4188
UA_StatusCode UA_Client_forEachChildNodeCall(UA_Client *client, UA_NodeId parentNodeId, UA_NodeIteratorCallback callback, void *handle)
Definition: open62541.c:25574
#define UA_STATUSCODE_BADNODEIDUNKNOWN
Definition: open62541.h:707
#define UA_TYPES_OPENSECURECHANNELREQUEST
Definition: open62541.h:4297
#define UA_NS0ID_SERVER_SERVERSTATUS_STATE
Definition: open62541.h:2543
#define UA_STATUSCODE_BADWOULDBLOCK
Definition: open62541.h:876
UA_StatusCode UA_NodeStore_insert(UA_NodeStore *ns, UA_Node *node)
Insert / Get / Replace / Remove ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.c:19389
#define UA_NS0ID_HASENCODING
Definition: open62541.h:1833
#define UA_NS0ID_NONHIERARCHICALREFERENCES
Definition: open62541.h:1827
SignatureData ^^^^^^^^^^^^^ A digital signature.
Definition: open62541.h:3688
#define UA_TYPES_CLOSESECURECHANNELRESPONSE
Definition: open62541.h:4522
DeleteSubscriptionsRequest ^^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:3917
#define UA_STATUSCODE_BADINDEXRANGENODATA
Definition: open62541.h:710
UA_Node * UA_NodeStore_getCopy(UA_NodeStore *ns, const UA_NodeId *nodeid)
Definition: open62541.c:19454
UA_Double revisedSessionTimeout
Definition: open62541.h:5155
#define UA_STATUSCODE_GOODENTRYREPLACED
Definition: open62541.h:845
size_t UA_readNumber(UA_Byte *buf, size_t buflen, UA_UInt32 *number)
Definition: open62541.c:15141
UA_ServerState state
Definition: open62541.h:4832
UA_UserTokenType tokenType
Definition: open62541.h:4344
UA_DataValue value
Definition: open62541.h:3636
#define UA_TYPES_WRITERESPONSE
Definition: open62541.h:4208
#define UA_STATUSCODE_BADMONITOREDITEMFILTERINVALID
Definition: open62541.h:722
double UA_Double
Double ^^^^^^ An IEEE double precision (64 bit) floating point value.
Definition: open62541.h:1001
MonitoredItemModifyResult ^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:3316
#define UA_LOG_INFO_SESSION(LOGGER, SESSION, MSG,...)
Definition: open62541.c:3790
#define SLIST_FOREACH_SAFE(var, head, field, tvar)
Definition: open62541.c:150
#define UA_NS0ID_INT64
Definition: open62541.h:1803
UA_MonitoredItemCreateResult * results
Definition: open62541.h:4685
UA_ResponseHeader responseHeader
Definition: open62541.h:5152
#define UA_STATUSCODE_BADSTATENOTACTIVE
Definition: open62541.h:795
#define UA_STATUSCODE_BADTARGETNODEIDINVALID
Definition: open62541.h:762
#define SLIST_REMOVE(head, elm, type, field)
Definition: open62541.c:180
void * handle
Definition: open62541.h:9487
#define UA_TYPES_MODIFYSUBSCRIPTIONRESPONSE
Definition: open62541.h:4282
#define UA_STATUSCODE_BADDIALOGNOTACTIVE
Definition: open62541.h:829
UA_Boolean executable
Definition: open62541.h:3608
#define UA_NS0ID_HASMODELLINGRULE
Definition: open62541.h:1832
UA_StatusCode __UA_Server_read(UA_Server *server, const UA_NodeId *nodeId, const UA_AttributeId attributeId, void *v)
Definition: open62541.c:20963
#define UA_NS0ID_SERVER_AUDITING
Definition: open62541.h:2635
#define UA_STATUSCODE_BADBROWSENAMEDUPLICATED
Definition: open62541.h:758
#define UA_TYPES_SUBSCRIPTIONACKNOWLEDGEMENT
Definition: open62541.h:3867
ReferenceDescription ^^^^^^^^^^^^^^^^^^^^ The description of a reference.
Definition: open62541.h:4571
UA_UInt16 sourcePicoseconds
Definition: open62541.h:1577
#define UA_TYPES_USERIDENTITYTOKEN
Definition: open62541.h:3730
#define UA_STATUSCODE_BADINVALIDSELFREFERENCE
Definition: open62541.h:764
#define UA_STATUSCODE_GOODMOREDATA
Definition: open62541.h:848
#define SLIST_ENTRY(type)
Definition: open62541.c:132
UA_ResponseHeader responseHeader
Definition: open62541.h:5087
UA_DateTime timestamp
Definition: open62541.h:3302
UA_String transportProfileUri
Definition: open62541.h:5076
#define UA_STATUSCODE_BADTOOMANYMATCHES
Definition: open62541.h:777
UA_Client_Authentication
Definition: open62541.c:4729
#define UA_NS0ID_SERVER_SERVERREDUNDANCY
Definition: open62541.h:2573
void Service_UnregisterNodes(UA_Server *server, UA_Session *session, const UA_UnregisterNodesRequest *request, UA_UnregisterNodesResponse *response)
Definition: open62541.c:23313
UA_Int32 symbolicId
Definition: open62541.h:1595
#define UA_TYPES_INT32
Int32 ^^^^^.
Definition: open62541.h:3121
#define UA_NodeStore_newReferenceTypeNode()
Definition: open62541.c:3998
#define UA_STATUSCODE_BADRESPONSETOOLARGE
Definition: open62541.h:661
#define UA_NS0ID_ADDREFERENCESREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2092
#define UA_STATUSCODE_BADUSERSIGNATUREINVALID
Definition: open62541.h:747
const UA_ObjectTypeNode * getObjectNodeType(UA_Server *server, const UA_ObjectNode *node)
Definition: open62541.c:17879
BrowseNextRequest ^^^^^^^^^^^^^^^^^ Continues one or more browse operations.
Definition: open62541.h:4214
UA_ResponseHeader responseHeader
Definition: open62541.h:4304
size_t UA_calcSizeBinary(void *p, const UA_DataType *type)
Definition: open62541.c:7567
#define UA_STATUSCODE_BADREFERENCETYPEIDINVALID
Definition: open62541.h:736
UA_Guid UA_Guid_random(void)
Definition: open62541.c:4924
#define UA_NS0ID_INTEGER
Definition: open62541.h:1822
UA_StatusCode MonitoredItem_registerSampleJob(UA_Server *server, UA_MonitoredItem *mon)
#define UA_STATUSCODE_BADCERTIFICATEISSUERREVOKED
Definition: open62541.h:684
#define UA_STATUSCODE_BADSUBSCRIPTIONIDINVALID
Definition: open62541.h:695
#define SIMPLEQ_FIRST(head)
Definition: open62541.c:297
const UA_encodeBinarySignature encodeBinaryJumpTable[UA_BUILTIN_TYPES_COUNT+1]
Definition: open62541.c:7181
UA_StatusCode getTypeHierarchy(UA_NodeStore *ns, const UA_Node *rootRef, UA_Boolean inverse, UA_NodeId **typeHierarchy, size_t *typeHierarchySize)
Definition: open62541.c:17737
#define UA_TYPES_COUNT
Every type is assigned an index in an array containing the type descriptions.
Definition: open62541.h:3084
UA_Session * UA_SecureChannel_getSession(UA_SecureChannel *channel, UA_NodeId *token)
Definition: open62541.c:15251
UA_SecureChannel channel
Definition: open62541.c:4744
UA_ResponseHeader responseHeader
Definition: open62541.h:4201
#define UA_OPEN62541_VER_MAJOR
Library Version
Definition: open62541.h:39
#define CLOSESOCKET(S)
Definition: open62541.c:26739
#define UA_NS0ID_HASPROPERTY
Definition: open62541.h:1839
DeleteReferencesRequest ^^^^^^^^^^^^^^^^^^^^^^^ Delete one or more references from the server address...
Definition: open62541.h:4747
#define UA_NS0ID_INT16
Definition: open62541.h:1799
Argument ^^^^^^^^ An argument for a method.
Definition: open62541.h:3711
#define UA_LOCALIZEDTEXT_ENCODINGMASKTYPE_LOCALE
Definition: open62541.c:6636
size_t subscriptionAcknowledgementsSize
Definition: open62541.h:4481
#define UA_NS0ID_HASDESCRIPTION
Definition: open62541.h:1834
UA_UInt16 memberTypeIndex
Definition: open62541.h:1635
UserNameIdentityToken ^^^^^^^^^^^^^^^^^^^^^ A token representing a user identified by a user name and...
Definition: open62541.h:4023
UA_UInt32 * arrayDimensions
Definition: open62541.h:1405
UA_StatusCode writeDataTypeAttribute(UA_Server *server, UA_VariableNode *node, const UA_NodeId *dataType, const UA_NodeId *constraintDataType)
Definition: open62541.c:20420
UA_Byte userAccessLevel
Definition: open62541.c:3467
#define UA_TYPES_CLOSESESSIONRESPONSE
Definition: open62541.h:4900
#define UA_NS0ID_MODIFYSUBSCRIPTIONREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2391
void Service_ActivateSession(UA_Server *server, UA_SecureChannel *channel, UA_Session *session, const UA_ActivateSessionRequest *request, UA_ActivateSessionResponse *response)
Definition: open62541.c:19953
UA_Boolean overlayable
Definition: open62541.h:1662
UA_ExtensionObject additionalHeader
Definition: open62541.h:3908
#define UA_STATUSCODE_BADNOCONTINUATIONPOINTS
Definition: open62541.h:735
UA_StatusCode UA_SessionManager_removeSession(UA_SessionManager *sm, const UA_NodeId *token)
Definition: open62541.c:18945
#define UA_NS0ID_HASORDEREDCOMPONENT
Definition: open62541.h:1842
#define UA_TYPES_DATACHANGEFILTER
Definition: open62541.h:4878
#define UA_STATUSCODE_BADTYPEMISMATCH
Definition: open62541.h:786
UA_Double timeout
Definition: open62541.c:3736
UA_RequestHeader requestHeader
Definition: open62541.h:4316
UA_BrowseDirection browseDirection
Definition: open62541.h:4439
UA_NodeId referenceTypeId
Definition: open62541.h:3700
#define UA_STATUSCODE_BADTCPINTERNALERROR
Definition: open62541.h:801
#define UA_STATUSCODE_BADTCPMESSAGETOOLARGE
Definition: open62541.h:799
void * UA_Array_new(size_t size, const UA_DataType *type)
Definition: open62541.c:5766
CallMethodResult ^^^^^^^^^^^^^^^^.
Definition: open62541.h:3443
#define UA_TYPES_UINT32
UInt32 ^^^^^^.
Definition: open62541.h:3127
UA_UInt16 UA_Server_addNamespace(UA_Server *server, const char *name)
Definition: open62541.c:15786
UA_StatusCode compatibleArrayDimensions(size_t constraintArrayDimensionsSize, const UA_UInt32 *constraintArrayDimensions, size_t testArrayDimensionsSize, const UA_UInt32 *testArrayDimensions)
Definition: open62541.c:20141
AsymmetricAlgorithmSecurityHeader ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Security Header.
Definition: open62541.c:2591
TcpErrorMessage ^^^^^^^^^^^^^^^ Error Message.
Definition: open62541.c:2563
UA_Boolean processed
Definition: open62541.c:25371
#define UA_STATUSCODE_BADNOTIMPLEMENTED
Definition: open62541.h:719
UA_NODE_BASEATTRIBUTES UA_NODE_VARIABLEATTRIBUTES UA_Byte accessLevel
Definition: open62541.c:3466
UA_ExtensionObjectEncoding
Definition: open62541.h:1537
size_t nodesToWriteSize
Definition: open62541.h:4412
UA_VARIANT_ENCODINGMASKTYPE
Definition: open62541.c:6856
#define UA_TYPES_BYTESTRING
ByteString ^^^^^^^^^^.
Definition: open62541.h:3175
UA_UInt32 u32
Definition: open62541.c:777
SignedSoftwareCertificate ^^^^^^^^^^^^^^^^^^^^^^^^^ A software certificate with a digital signature...
Definition: open62541.h:3241
#define UA_STATUSCODE_BADVIEWIDUNKNOWN
Definition: open62541.h:769
#define UA_STATUSCODE_BADNODEATTRIBUTESINVALID
Definition: open62541.h:759
#define UA_TYPES_UINT64
UInt64 ^^^^^^.
Definition: open62541.h:3139
UA_LocalizedText displayName
Definition: open62541.h:3352
#define UA_UINT16_MAX
Definition: open62541.h:956
#define UA_STATUSCODE_BADDATALOST
Definition: open62541.h:839
#define UA_STATUSCODE_BADDEPENDENTVALUECHANGED
Definition: open62541.h:861
#define UA_NS0ID_SERVER_SERVERSTATUS_SECONDSTILLSHUTDOWN
Definition: open62541.h:2633
UA_Boolean UA_Node_hasSubTypeOrInstances(const UA_Node *node)
Definition: open62541.c:17887
UA_String * namespaces
Definition: open62541.c:4226
UA_DataValue * results
Definition: open62541.h:4776
UA_UInt32 requestId
Definition: open62541.c:2619
#define UA_STATUSCODE_BADREQUESTCANCELLEDBYCLIENT
Definition: open62541.h:698
#define UA_STATUSCODE_BADCERTIFICATEHOSTNAMEINVALID
Definition: open62541.h:676
#define UA_STATUSCODE_GOODCALLAGAIN
Definition: open62541.h:864
UA_UInt32 maxRequestMessageSize
Definition: open62541.c:3734
ReadValueId ^^^^^^^^^^^.
Definition: open62541.h:3873
UA_String UA_String_fromChars(char const src[])
Definition: open62541.c:4826
#define CHECK_NODECLASS_WRITE(CLASS)
Definition: open62541.c:21029
#define UA_NS0ID_INT32
Definition: open62541.h:1801
const UA_DataType * UA_findDataType(const UA_NodeId *typeId)
Builtin data types can be accessed as UA_TYPES[UA_TYPES_XXX], where XXX is the name of the data type...
Definition: open62541.c:4793
UA_String additionalInfo
Definition: open62541.h:1599
UA_Int64 i64
Definition: open62541.c:780
#define UA_STATUSCODE_BADDATAENCODINGINVALID
Definition: open62541.h:711
UA_StatusCode UA_SecureChannel_generateNonce(UA_ByteString *nonce)
Definition: open62541.c:15206
UA_String indexRange
Definition: open62541.h:3635
const UA_NodeId UA_NODEID_NULL
Definition: open62541.c:4787
UA_ExtensionObject filter
Definition: open62541.h:3677
#define UA_STATUSCODE_BADCERTIFICATECHAININCOMPLETE
Definition: open62541.h:685
#define UA_STATUSCODE_BADSESSIONIDINVALID
Definition: open62541.h:692
#define DOUBLE_INF
Definition: open62541.c:6212
UA_Connection connection
Definition: open62541.c:4740
uint16_t UA_UInt16
UInt16 ^^^^^^ An integer value between 0 and 65 535.
Definition: open62541.h:954
#define UA_STATUSCODE_BADBROWSENAMEINVALID
Definition: open62541.h:757
#define UA_STATUSCODE_GOODNODATA
Definition: open62541.h:847
#define UA_NS0ID_UINTEGER
Definition: open62541.h:1823
#define UA_NS0ID_HASCAUSE
Definition: open62541.h:1845
UA_LocalizedText inverseName
Definition: open62541.h:4377
#define UA_NS0ID_SERVER_SERVERCAPABILITIES_MAXBROWSECONTINUATIONPOINTS
Definition: open62541.h:2611
#define UA_NS0ID_BASEDATAVARIABLETYPE
Definition: open62541.h:1851
UA_ExtensionObject nodeAttributes
Definition: open62541.h:4819
UA_Boolean hasLocalizedText
Definition: open62541.h:1590
UA_UInt16 data3
Definition: open62541.h:1110
OpenSecureChannelResponse ^^^^^^^^^^^^^^^^^^^^^^^^^ Creates a secure channel with a server...
Definition: open62541.h:4084
void Service_Read_single(UA_Server *server, UA_Session *session, UA_TimestampsToReturn timestamps, const UA_ReadValueId *id, UA_DataValue *v)
Definition: open62541.c:20716
UA_ClientState UA_Client_getState(UA_Client *client)
Definition: open62541.c:24744
UA_Boolean fixedSize
Definition: open62541.h:1660
UA_StatusCode UA_Server_delayedFree(UA_Server *server, void *data)
Definition: open62541.c:18292
#define UA_STATUSCODE_BADTIMESTAMPNOTSUPPORTED
Definition: open62541.h:843
UA_Boolean hasSourcePicoseconds
Definition: open62541.h:1572
struct UA_DiagnosticInfo * innerDiagnosticInfo
Definition: open62541.h:1601
AddNodesRequest ^^^^^^^^^^^^^^^ Adds one or more nodes to the server address space.
Definition: open62541.h:4988
#define UA_LOG_DEBUG_SESSION(LOGGER, SESSION, MSG,...)
Definition: open62541.c:3783
#define UA_TYPES_CREATESUBSCRIPTIONREQUEST
Definition: open62541.h:4237
#define UA_NS0ID_VIEWSFOLDER
Definition: open62541.h:1865
#define UA_TYPES_CALLMETHODRESULT
Definition: open62541.h:3453
UA_AsymmetricAlgorithmSecurityHeader clientAsymAlgSettings
Definition: open62541.c:3236
#define UA_TYPES_PUBLISHRESPONSE
Definition: open62541.h:4006
UA_QualifiedName browseName
Definition: open62541.h:4575
RequestHeader ^^^^^^^^^^^^^ The header passed with every server request.
Definition: open62541.h:3300
UA_SecurityTokenRequestType requestType
Definition: open62541.h:4291
#define ADDPROFILEARRAY(x)
UA_StatusCode UA_Subscription_deleteMonitoredItem(UA_Server *server, UA_Subscription *sub, UA_UInt32 monitoredItemID)
UA_UInt32 protocolVersion
Definition: open62541.c:2549
Definition: open62541.c:3215
#define UA_TYPES_RELATIVEPATH
Definition: open62541.h:4662
UA_StatusCode UA_SecureChannelManager_open(UA_SecureChannelManager *cm, UA_Connection *conn, const UA_OpenSecureChannelRequest *request, UA_OpenSecureChannelResponse *response)
Definition: open62541.c:18721
#define UA_NS0ID_GENERATESEVENT
Definition: open62541.h:1836
#define UA_NS0ID_GETENDPOINTSREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2026
UA_UInt32 maxMessageSize
Definition: open62541.h:9453
#define UA_TYPES_BROWSERESPONSE
Definition: open62541.h:5145
#define UA_TYPES_FINDSERVERSRESPONSE
Definition: open62541.h:4939
#define UA_STATUSCODE_BADTIMEOUT
Definition: open62541.h:663
UA_UInt16 namespaceIndex
Definition: open62541.h:1288
#define FNV_PRIME_32
Definition: open62541.c:5044
#define UA_TYPES_MODIFYSUBSCRIPTIONREQUEST
Definition: open62541.h:4336
AddNodesResponse ^^^^^^^^^^^^^^^^ Adds one or more nodes to the server address space.
Definition: open62541.h:4491
#define UA_STATUSCODE_BADNOVALIDCERTIFICATES
Definition: open62541.h:749
#define UA_TYPES_SBYTE
SByte ^^^^^.
Definition: open62541.h:3097
#define errno__
Definition: open62541.c:26786
struct channel_list_entry channel_list_entry
#define UA_TYPES_ADDNODESITEM
Definition: open62541.h:4823
void Service_DeleteMonitoredItems(UA_Server *server, UA_Session *session, const UA_DeleteMonitoredItemsRequest *request, UA_DeleteMonitoredItemsResponse *response)
SetPublishingModeRequest ^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:3562
const UA_Guid UA_GUID_NULL
Definition: open62541.c:4786
#define UA_STATUSCODE_BADMONITOREDITEMFILTERUNSUPPORTED
Definition: open62541.h:723
UA_StatusCode * results
Definition: open62541.h:4713
#define UA_TYPES_DELETENODESRESPONSE
Definition: open62541.h:4718
UA_BrowseResult UA_Server_browse(UA_Server *server, UA_UInt32 maxrefs, const UA_BrowseDescription *descr)
Browsing
Definition: open62541.c:22915
UA_Double requestedPublishingInterval
Definition: open62541.h:4229
#define TAILQ_LAST(head, headname)
Definition: open62541.c:453
UA_StatusCode readValueAttribute(UA_Server *server, const UA_VariableNode *vn, UA_DataValue *v)
Definition: open62541.c:20532
#define UA_STATUSCODE_BADREQUESTCANCELLEDBYREQUEST
Definition: open62541.h:751
void UA_NodeStore_deleteNode(UA_Node *node)
Definition: open62541.c:19382
#define UA_NS0ID_SERVERCAPABILITIESTYPE
Definition: open62541.h:2489
const UA_DataType * type
Definition: open62541.h:1400
RegisterNodesResponse ^^^^^^^^^^^^^^^^^^^^^ Registers one or more nodes for repeated use within a ses...
Definition: open62541.h:4303
UA_ResponseHeader responseHeader
Definition: open62541.h:3994
int64_t UA_DateTime
Definition: open62541.h:1070
UA_Int32 sockfd
Definition: open62541.h:9484
UA_MonitoredItemModifyResult * results
Definition: open62541.h:4762
DeleteMonitoredItemsResponse ^^^^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:3941
UA_StatusCode writeValueAttribute(UA_Server *server, UA_VariableNode *node, const UA_DataValue *value, const UA_String *indexRange)
Definition: open62541.c:20581
#define UA_TYPES_CONTENTFILTER
Definition: open62541.h:4964
#define UA_TRANSPORT_MESSAGETYPE
Definition: open62541.c:2585
UA_UInt32 secondsTillShutdown
Definition: open62541.h:4834
#define UA_NS0ID_PUBLISHREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2418
#define UA_TYPES_ARGUMENT
Definition: open62541.h:3720
#define TAILQ_INSERT_HEAD(head, elm, field)
Definition: open62541.c:492
UA_Int16 i16
Definition: open62541.c:776
UA_Node node
Definition: open62541.c:19175
void UA_Array_delete(void *p, size_t size, const UA_DataType *type)
Definition: open62541.c:5812
#define UA_STATUSCODE_BADNOTCONNECTED
Definition: open62541.h:810
#define UA_TYPES_ADDREFERENCESITEM
Definition: open62541.h:4623
#define UA_STATUSCODE_BADSERVERHALTED
Definition: open62541.h:667
ContentFilterResult ^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4601
UA_Client * client
Definition: open62541.c:25370
UA_SByte i8
Definition: open62541.c:774
ReferenceNode ^^^^^^^^^^^^^ Specifies a reference which belongs to a node.
Definition: open62541.h:3699
#define UA_TYPES_MESSAGESECURITYMODE
Definition: open62541.h:3668
UA_DataChangeTrigger trigger
Definition: open62541.h:4873
UA_EndpointDescription * endpoints
Definition: open62541.h:5089
UA_String sessionName
Definition: open62541.c:3731
UA_ByteString clientNonce
Definition: open62541.c:3238
UA_AddReferencesItem * referencesToAdd
Definition: open62541.h:4790
#define UA_STATUSCODE_BADREQUESTTIMEOUT
Definition: open62541.h:804
UA_UInt16 memSize
Definition: open62541.h:1655
UA_Boolean includeSubtypes
Definition: open62541.h:3476
#define UA_NS0ID_HASCOMPONENT
Definition: open62541.h:1840
Definition: open62541.c:4065
#define UA_STATUSCODE_BADOUTOFRANGE
Definition: open62541.h:715
#define UA_STATUSCODE_BADQUERYTOOCOMPLEX
Definition: open62541.h:778
size_t length
Definition: open62541.h:1039
UA_UInt32 retransmitSequenceNumber
Definition: open62541.h:4455
UA_ExpandedNodeId typeDefinition
Definition: open62541.h:4820
#define UA_STATUSCODE_BADHISTORYOPERATIONINVALID
Definition: open62541.h:782
UA_StatusCode Subscription_registerPublishJob(UA_Server *server, UA_Subscription *sub)
ReadRequest ^^^^^^^^^^^.
Definition: open62541.h:4799
UA_MonitoringParameters requestedParameters
Definition: open62541.h:4738
GetEndpointsResponse ^^^^^^^^^^^^^^^^^^^^ Gets the endpoints used by the server.
Definition: open62541.h:5086
#define UA_STATUSCODE_BADREFRESHINPROGRESS
Definition: open62541.h:823
UA_UInt16 data2
Definition: open62541.h:1109
UA_ApplicationDescription * servers
Definition: open62541.h:4936
#define UA_TYPES_ADDNODESREQUEST
Definition: open62541.h:4994
UA_ChannelSecurityToken securityToken
Definition: open62541.c:3234
#define UA_TYPES_CREATESESSIONRESPONSE
Definition: open62541.h:5166
CallResponse ^^^^^^^^^^^^.
Definition: open62541.h:4696
uint64_t UA_UInt64
UInt64 ^^^^^^ An integer value between 0 and 18 446 744 073 709 551 615.
Definition: open62541.h:987
#define UA_TYPES_DELETEREFERENCESRESPONSE
Definition: open62541.h:4676
#define UA_STATUSCODE_BADFILTERELEMENTINVALID
Definition: open62541.h:732
#define UA_NODEIDTYPE_NUMERIC_TWOBYTE
Definition: open62541.c:6458
#define TAILQ_ENTRY(type)
Definition: open62541.c:441
UA_StatusCode UA_Server_setVariableNode_dataSource(UA_Server *server, const UA_NodeId nodeId, const UA_DataSource dataSource)
Definition: open62541.c:22567
#define UA_STATUSCODE_BADDIALOGRESPONSEINVALID
Definition: open62541.h:830
#define DAYS_PER_400Y
Definition: open62541.c:26326
UA_StatusCode(* UA_exchangeEncodeBuffer)(void *handle, UA_ByteString *buf, size_t offset)
Definition: open62541.c:853
#define UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO_PRODUCTURI
Definition: open62541.h:2546
SecureConversationMessageAbortBody ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Secure Conversation Message Abo...
Definition: open62541.c:2525
SetMonitoringModeRequest ^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4386
void() UA_ProcessMessageCallback(void *application, UA_SecureChannel *channel, UA_MessageType messageType, UA_UInt32 requestId, const UA_ByteString *message)
Chunking
Definition: open62541.c:3268
#define DOUBLE_NEG_ZERO
Definition: open62541.c:6214
#define UA_STATUSCODE_BADMONITOREDITEMIDINVALID
Definition: open62541.h:721
#define UA_STATUSCODE_BADAGGREGATECONFIGURATIONREJECTED
Definition: open62541.h:852
UA_Boolean activated
Definition: open62541.c:3730
#define UA_TYPES_FLOAT
Float ^^^^^.
Definition: open62541.h:3145
#define UA_STATUSCODE_BADTOOMANYSESSIONS
Definition: open62541.h:746
#define UA_STATUSCODE_BADIDENTITYCHANGENOTSUPPORTED
Definition: open62541.h:750
#define UA_INT64_MAX
Definition: open62541.h:981
UA_Boolean containsNoLoops
Definition: open62541.h:3269
void Service_OpenSecureChannel(UA_Server *server, UA_Connection *connection, const UA_OpenSecureChannelRequest *request, UA_OpenSecureChannelResponse *response)
SecureChannel Service Set This Service Set defines Services used to open a communication channel that...
Definition: open62541.c:19860
#define UA_TYPES_REPUBLISHRESPONSE
Definition: open62541.h:4729
UA_StatusCode * results
Definition: open62541.h:4203
#define UA_free(_p_ptr)
UA_Boolean deleteBidirectional
Definition: open62541.h:3623
UA_DateTime timestamp
Definition: open62541.h:3902
UA_DateTime sourceTimestamp
Definition: open62541.h:1576
size_t(* getJobs)(UA_ServerNetworkLayer *nl, UA_Job **jobs, UA_UInt16 timeout)
Definition: open62541.h:9786
UA_DateTime nextChannelRenewal
Definition: open62541.c:4746
#define UA_TYPES_MONITOREDITEMMODIFYREQUEST
Definition: open62541.h:4017
UA_NodeId authenticationToken
Definition: open62541.h:5154
#define UA_LOG_INFO_CHANNEL(LOGGER, CHANNEL, MSG,...)
Definition: open62541.c:3289
#define UA_NS0ID_SERVER_GETMONITOREDITEMS_OUTPUTARGUMENTS
Definition: open62541.h:2771
void UA_Session_deleteMembersCleanup(UA_Session *session, UA_Server *server)
Definition: open62541.c:15653
#define UA_STATUSCODE_GOODNONCRITICALTIMEOUT
Definition: open62541.h:865
DeleteNodesRequest ^^^^^^^^^^^^^^^^^^ Delete one or more nodes from the server address space...
Definition: open62541.h:3981
#define UA_TYPES_READRESPONSE
Definition: open62541.h:4781
#define UA_STATUSCODE_BADNOTSUPPORTED
Definition: open62541.h:716
ContentFilter ^^^^^^^^^^^^^.
Definition: open62541.h:4959
UA_Variant * inputArguments
Definition: open62541.h:3504
UA_Server * UA_Server_new(const UA_ServerConfig config)
Definition: open62541.c:16141
#define UA_LOG_WARNING_SESSION(LOGGER, SESSION, MSG,...)
Definition: open62541.c:3797
SetPublishingModeResponse ^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4587
status(* UA_decodeBinarySignature)(void *UA_RESTRICT dst, const UA_DataType *type)
Definition: open62541.c:5871
UA_String reason
Definition: open62541.c:2565
UA_MessageSecurityMode securityMode
Definition: open62541.h:5072
#define UA_NODESTORE_TOMBSTONE
Definition: open62541.c:19178
#define UA_STATUSCODE_BADNODEIDEXISTS
Definition: open62541.h:755
#define UA_TYPES_MONITOREDITEMCREATEREQUEST
Definition: open62541.h:4741
#define UA_STATUSCODE_UNCERTAINSENSORNOTACCURATE
Definition: open62541.h:819
const UA_decodeBinarySignature decodeBinaryJumpTable[UA_BUILTIN_TYPES_COUNT+1]
Definition: open62541.c:7267
#define UA_NS0ID_WRITEREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2271
#define UA_NS0ID_SERVER
Definition: open62541.h:2537
UA_EndpointDescription * endpointDescriptions
Definition: open62541.c:4216
UA_MonitoringParameters requestedParameters
Definition: open62541.h:4014
UA_ResponseHeader responseHeader
Definition: open62541.h:4644
#define UA_STATUSCODE_BADINVALIDTIMESTAMPARGUMENT
Definition: open62541.h:784
BuildInfo ^^^^^^^^^.
Definition: open62541.h:3792
#define UA_NS0ID_FLOAT
Definition: open62541.h:1805
UA_UInt32 resultMask
Definition: open62541.h:4443
UA_StatusCode UA_Client_writeArrayDimensionsAttribute(UA_Client *client, const UA_NodeId nodeId, const UA_UInt32 *newArrayDimensions, size_t newArrayDimensionsSize)
Definition: open62541.c:25833
UA_ResponseHeader responseHeader
Definition: open62541.h:4145
QueryDataSet ^^^^^^^^^^^^.
Definition: open62541.h:3539
#define UA_TYPES_READREQUEST
Definition: open62541.h:4807
#define USERNAME_POLICY
Definition: open62541.c:4159
void UA_NodeStore_iterate(UA_NodeStore *ns, UA_NodeStore_nodeVisitor visitor)
Definition: open62541.c:19485
const UA_EXPORT UA_ClientConfig UA_ClientConfig_standard
Definition: open62541.c:27675
#define UA_STATUSCODE_BADAGGREGATELISTMISMATCH
Definition: open62541.h:849
#define UA_STATUSCODE_BADOPERATIONABANDONED
Definition: open62541.h:874
void UA_SecureChannel_init(UA_SecureChannel *channel)
Definition: open62541.c:15167
#define UA_TYPES_USERNAMEIDENTITYTOKEN
Definition: open62541.h:4030
UA_StatusCode __UA_Server_write(UA_Server *server, const UA_NodeId *nodeId, const UA_AttributeId attributeId, const UA_DataType *attr_type, const void *attr)
Definition: open62541.c:21193
#define SLIST_INSERT_HEAD(head, elm, field)
Definition: open62541.c:167
UA_ObjectLifecycleManagement lifecycleManagement
Definition: open62541.c:3548
#define UA_TYPES_BROWSEREQUEST
Definition: open62541.h:5008
#define UA_STATUSCODE_BADREFERENCELOCALONLY
Definition: open62541.h:765
#define UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED
Definition: open62541.h:659
UA_Boolean final
Definition: open62541.c:3228
#define UA_EXPANDEDNODEID_SERVERINDEX_FLAG
Definition: open62541.c:6462
void Service_Call(UA_Server *server, UA_Session *session, const UA_CallRequest *request, UA_CallResponse *response)
void UA_SessionManager_cleanupTimedOut(UA_SessionManager *sm, UA_DateTime nowMonotonic)
Definition: open62541.c:18877
UA_UInt32 requestedMaxReferencesPerNode
Definition: open62541.h:5003
ReferenceTypeAttributes ^^^^^^^^^^^^^^^^^^^^^^^ The attributes for a reference type node...
Definition: open62541.h:4369
#define UA_STATUSCODE_BADTOOMANYOPERATIONS
Definition: open62541.h:669
DeleteNodesResponse ^^^^^^^^^^^^^^^^^^^ Delete one or more nodes from the server address space...
Definition: open62541.h:4710
#define UA_STATUSCODE_GOODDEPENDENTVALUECHANGED
Definition: open62541.h:858
UA_NodeClass targetNodeClass
Definition: open62541.h:4620
UA_ExpandedNodeId typeDefinition
Definition: open62541.h:4578
#define TAILQ_INIT(head)
Definition: open62541.c:487
#define UA_NS0ID_SERVER_SERVERREDUNDANCY_REDUNDANCYSUPPORT
Definition: open62541.h:2662
UA_Connection * connection
Definition: open62541.c:3242
UA_ResponseHeader responseHeader
Definition: open62541.h:5112
#define UA_NS0ID_SBYTE
Definition: open62541.h:1797
TranslateBrowsePathsToNodeIdsResponse ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Translates one or more pa...
Definition: open62541.h:4858
#define UA_LOG_DEBUG_CHANNEL(LOGGER, CHANNEL, MSG,...)
Definition: open62541.c:3284
UA_UInt16 nanoSec
Definition: open62541.h:1088
UA_Connection UA_ClientConnectionTCP(UA_ConnectionConfig conf, const char *endpointUrl, UA_Logger logger)
Definition: open62541.c:27352
UA_Node * UA_NodeStore_newNode(UA_NodeClass nodeClass)
Node Lifecycle ^^^^^^^^^^^^^^.
Definition: open62541.c:19374
#define UA_NS0ID_DATATYPESFOLDER
Definition: open62541.h:1868
UA_String password
Definition: open62541.c:4751
UA_Boolean isNodeInTree(UA_NodeStore *ns, const UA_NodeId *leafNode, const UA_NodeId *nodeToFind, const UA_NodeId *referenceTypeIds, size_t referenceTypeIdsSize)
Definition: open62541.c:17811
#define UA_STATUSCODE_BADMESSAGENOTAVAILABLE
Definition: open62541.h:793
#define APPLICATION_URI
Definition: open62541.c:27601
#define UA_TYPES_ADDNODESRESPONSE
Definition: open62541.h:4499
void Service_Publish(UA_Server *server, UA_Session *session, const UA_PublishRequest *request, UA_UInt32 requestId)
UA_StatusCode UA_Variant_setRangeCopy(UA_Variant *v, const void *array, size_t arraySize, const UA_NumericRange range)
Definition: open62541.c:5504
#define UA_TYPES_PARSINGRESULT
Definition: open62541.h:3467
#define UA_PRINTF_GUID_DATA(GUID)
Definition: open62541.h:9727
#define INTERRUPTED
Definition: open62541.c:26787
#define UA_NS0ID_STRING
Definition: open62541.h:1807
#define UA_NS0ID_UINT64
Definition: open62541.h:1804
UA_UInt32 messageType
Definition: open62541.c:3225
#define UA_NS0ID_SERVER_SERVERCAPABILITIES_MINSUPPORTEDSAMPLERATE
Definition: open62541.h:2555
void UA_SecureChannelManager_deleteMembers(UA_SecureChannelManager *cm)
Definition: open62541.c:18653
#define UA_ASSERT_RCU_UNLOCKED()
Definition: open62541.c:4192
#define UA_SEC_TO_DATETIME
Definition: open62541.h:1075
void(* UA_ServerCallback)(UA_Server *server, void *data)
Definition: open62541.h:9574
UA_UInt32 maxResponseMessageSize
Definition: open62541.h:5047
UA_UInt16 nThreads
Definition: open62541.h:9822
UA_StatusCode UA_Server_run_startup(UA_Server *server)
Definition: open62541.c:18458
UA_UInt16 u16
Definition: open62541.c:775
ViewDescription ^^^^^^^^^^^^^^^ The view to browse.
Definition: open62541.h:3929
#define UA_NS0ID_REFERENCES
Definition: open62541.h:1826
#define UA_NS0ID_DELETENODESREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2098
#define UA_STATUSCODE_BADREQUESTINTERRUPTED
Definition: open62541.h:803
void(* UA_NodeStore_nodeVisitor)(const UA_Node *node)
Iteration ^^^^^^^^^ The following definitions are used to call a callback for every node in the nodes...
Definition: open62541.c:4049
#define UA_TYPES_STRING
String ^^^^^^.
Definition: open62541.h:3157
uint32_t pcg32_random_r(pcg32_random_t *rng)
Definition: open62541.c:26436
RepublishResponse ^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4724
#define UA_NS0ID_LOCALIZEDTEXT
Definition: open62541.h:1816
UA_NodeId nodeId
Definition: open62541.h:3852
CreateSubscriptionResponse ^^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4629
BrowseResponse ^^^^^^^^^^^^^^ Browse the references for one or more nodes from the server address spa...
Definition: open62541.h:5137
UA_UInt32 requestHandle
Definition: open62541.c:4756
float UA_Float
Float ^^^^^ An IEEE single precision (32 bit) floating point value.
Definition: open62541.h:995
#define UA_NS0ID_HASMODELPARENT
Definition: open62541.h:3066
UA_Boolean hasServerTimestamp
Definition: open62541.h:1571
Definition: open62541.c:4107
UA_UInt16 hour
Definition: open62541.h:1093
UA_NodeStoreEntry ** entries
Definition: open62541.c:19181
UA_UInt32 requestId
Definition: open62541.c:4745
UA_DateTime startTime
Definition: open62541.c:4214
UA_UInt32 sequenceNumber
Definition: open62541.h:3374
#define UA_STATUSCODE_BADNOTFOUND
Definition: open62541.h:717
UA_ResponseHeader responseHeader
Definition: open62541.h:4492
UA_LocalizedText description
Definition: open62541.h:3353
UA_Boolean hasValue
Definition: open62541.h:1568
UA_SecureChannel * UA_SecureChannelManager_get(UA_SecureChannelManager *cm, UA_UInt32 channelId)
Definition: open62541.c:18802
#define UA_STATUSCODE_BADSERVERNAMEMISSING
Definition: open62541.h:740
#define UA_STATUSCODE_BADDATAUNAVAILABLE
Definition: open62541.h:840
UA_UInt32 sendBufferSize
Definition: open62541.c:2551
void Service_Browse(UA_Server *server, UA_Session *session, const UA_BrowseRequest *request, UA_BrowseResponse *response)
Definition: open62541.c:22886
UA_Session * UA_SessionManager_getSession(UA_SessionManager *sm, const UA_NodeId *token)
Definition: open62541.c:18891
#define UA_NS0ID_XMLELEMENT
Definition: open62541.h:1811
void __UA_Client_Service(UA_Client *client, const void *request, const UA_DataType *requestType, void *response, const UA_DataType *responseType)
Definition: open62541.c:25455
UA_StatusCode UA_decodeBinary(const UA_ByteString *src, size_t *offset, void *dst, const UA_DataType *type) UA_FUNC_ATTR_WARN_UNUSED_RESULT
Definition: open62541.c:7323
UA_String UA_DateTime_toString(UA_DateTime t)
Definition: open62541.c:4888
#define UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO_BUILDNUMBER
Definition: open62541.h:2549
#define UA_NS0ID_SERVERDIAGNOSTICSTYPE
Definition: open62541.h:2490
#define UA_NS0ID_DELETEREFERENCESREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2104
UA_UInt64 u64
Definition: open62541.c:779
#define ANONYMOUS_POLICY
Definition: open62541.c:4158
void MonitoredItem_delete(UA_Server *server, UA_MonitoredItem *monitoredItem)
#define UA_TYPES_BROWSENEXTREQUEST
Definition: open62541.h:4221
#define VERSION(MAJOR, MINOR, PATCH, LABEL)
Definition: open62541.c:27607
void UA_Log_Stdout(UA_LogLevel level, UA_LogCategory category, const char *msg, va_list args)
Definition: open62541.c:27554
UA_ResponseHeader responseHeader
Definition: open62541.h:4760
UA_MessageSecurityMode securityMode
Definition: open62541.c:3233
void UA_Connection_deleteMembers(UA_Connection *connection)
Definition: open62541.c:14871
UA_StatusCode UA_EndpointUrl_split_ptr(const char *endpointUrl, char *hostname, const char **port, const char **path)
Definition: open62541.c:15025
void Service_CreateSubscription(UA_Server *server, UA_Session *session, const UA_CreateSubscriptionRequest *request, UA_CreateSubscriptionResponse *response)
Subscription Service Set Subscriptions are used to report Notifications to the Client.
UA_UInt32 subscriptionId
Definition: open62541.h:3995
#define UA_LOG_TRACE_CHANNEL(LOGGER, CHANNEL, MSG,...)
Log Helper
Definition: open62541.c:3279
#define UA_STATUSCODE_BADEXPECTEDSTREAMTOBLOCK
Definition: open62541.h:875
#define UA_STATUSCODE_BADSTRUCTUREMISSING
Definition: open62541.h:725
UA_StatusCode __UA_Client_writeAttribute(UA_Client *client, const UA_NodeId *nodeId, UA_AttributeId attributeId, const void *in, const UA_DataType *inDataType)
Definition: open62541.c:25797
#define UA_NS0ID_HASEFFECT
Definition: open62541.h:1846
void Service_CreateMonitoredItems(UA_Server *server, UA_Session *session, const UA_CreateMonitoredItemsRequest *request, UA_CreateMonitoredItemsResponse *response)
MonitoredItem Service Set Clients define MonitoredItems to subscribe to data and Events.
UA_DeleteReferencesItem * referencesToDelete
Definition: open62541.h:4750
void Service_Read(UA_Server *server, UA_Session *session, const UA_ReadRequest *request, UA_ReadResponse *response)
Query Service Set This Service Set is used to issue a Query to a Server.
Definition: open62541.c:20874
UA_Boolean discardOldest
Definition: open62541.h:3679
#define UA_TYPES_WRITEVALUE
Definition: open62541.h:3639
#define UA_SECURE_MESSAGE_HEADER_LENGTH
Definition: open62541.c:15165
#define UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO_BUILDDATE
Definition: open62541.h:2550
ObjectTypeAttributes ^^^^^^^^^^^^^^^^^^^^ The attributes for an object type node. ...
Definition: open62541.h:3736
UA_ExtensionObject userIdentityToken
Definition: open62541.h:4074
UA_StatusCode UA_Server_deleteReference(UA_Server *server, const UA_NodeId sourceNodeId, const UA_NodeId referenceTypeId, UA_Boolean isForward, const UA_ExpandedNodeId targetNodeId, UA_Boolean deleteBidirectional)
Definition: open62541.c:22511
UA_Boolean UA_String_equal(const UA_String *s1, const UA_String *s2)
Definition: open62541.c:4842
UserTokenPolicy ^^^^^^^^^^^^^^^ Describes a user token that can be used with a server.
Definition: open62541.h:4342
UA_ResponseHeader responseHeader
Definition: open62541.h:4697
UA_Boolean hasInnerDiagnosticInfo
Definition: open62541.h:1594
#define UA_STATUSCODE_BADENTRYEXISTS
Definition: open62541.h:841
#define CHECK_DATATYPE_SCALAR(EXP_DT)
Definition: open62541.c:21013
#define UA_STATUSCODE_BADVIEWVERSIONINVALID
Definition: open62541.h:772
struct UA_DelayedJob UA_DelayedJob
UA_StatusCode * results
Definition: open62541.h:4671
#define UA_NS0ID_HASSUBTYPE
Definition: open62541.h:1838
UA_BrowseResultMask
BrowseResultMask ^^^^^^^^^^^^^^^^ A bit mask which specifies what should be returned in a browse resp...
Definition: open62541.h:3279
#define UA_TYPES_USERTOKENTYPE
Definition: open62541.h:4061
UA_RequestHeader requestHeader
Definition: open62541.h:4465
#define UA_TYPES_ADDREFERENCESRESPONSE
Definition: open62541.h:4852
void(* deleteMembers)(UA_ServerNetworkLayer *nl)
Deletes the network content.
Definition: open62541.h:9799
UA_NodeId sessionId
Definition: open62541.c:3733
UA_StatusCode UA_Client_readArrayDimensionsAttribute(UA_Client *client, const UA_NodeId nodeId, UA_UInt32 **outArrayDimensions, size_t *outArrayDimensionsSize)
Definition: open62541.c:25926
UA_ValueSource
VariableNode
Definition: open62541.c:3441
UA_UInt32 messageSize
Definition: open62541.c:2630
UA_NodeId viewId
Definition: open62541.h:3930
#define UA_TYPES_CLOSESESSIONREQUEST
Definition: open62541.h:4320
#define UA_TYPES_DELETESUBSCRIPTIONSRESPONSE
Definition: open62541.h:4651
UA_ClientState state
Definition: open62541.c:4736
UA_UInt16 year
Definition: open62541.h:1096
UA_UInt32 protocolVersion
Definition: open62541.h:9450
UA_UserTokenPolicy token
Definition: open62541.c:4754
UA_UInt32 subscriptionId
Definition: open62541.h:4454
UA_ResponseHeader responseHeader
Definition: open62541.h:4845
void Service_Call_single(UA_Server *server, UA_Session *session, const UA_CallMethodRequest *request, UA_CallMethodResult *result)
UA_UInt16 UA_Server_run_iterate(UA_Server *server, UA_Boolean waitInternal)
Definition: open62541.c:18519
#define UA_NS0ID_ADDNODESREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2086
void * UA_new(const UA_DataType *type)
The following functions are used for generic handling of data types.
Definition: open62541.c:5580
UA_UInt32 requestedMaxKeepAliveCount
Definition: open62541.h:4231
#define UA_STATUSCODE_BADSECURECHANNELTOKENUNKNOWN
Definition: open62541.h:806
#define UA_STATUSCODE_BADSERVERURIINVALID
Definition: open62541.h:739
#define UA_NS0ID_DATAVALUE
Definition: open62541.h:1818
FindServersResponse ^^^^^^^^^^^^^^^^^^^ Finds the servers known to the discovery server.
Definition: open62541.h:4933
UA_StatusCode UA_Server_setVariableNode_valueCallback(UA_Server *server, const UA_NodeId nodeId, const UA_ValueCallback callback)
Definition: open62541.c:22541
#define UA_STATUSCODE_BADNODENOTINVIEW
Definition: open62541.h:738
UA_StatusCode __UA_Server_addNode(UA_Server *server, const UA_NodeClass nodeClass, const UA_NodeId requestedNewNodeId, const UA_NodeId parentNodeId, const UA_NodeId referenceTypeId, const UA_QualifiedName browseName, const UA_NodeId typeDefinition, const UA_NodeAttributes *attr, const UA_DataType *attributeType, UA_InstantiationCallback *instantiationCallback, UA_NodeId *outNewNodeId)
Definition: open62541.c:22049
size_t outputArgumentsSize
Definition: open62541.h:3449
CloseSessionResponse ^^^^^^^^^^^^^^^^^^^^ Closes a session with the server.
Definition: open62541.h:4896
#define UA_TYPES_FINDSERVERSREQUEST
Definition: open62541.h:4565
#define UA_NS0ID_TOSTATE
Definition: open62541.h:1844
UA_StatusCode UA_Server_run(UA_Server *server, volatile UA_Boolean *running)
Definition: open62541.c:18624
#define MANUFACTURER_NAME
Definition: open62541.c:27597
UA_UInt32 maxResponseMessageSize
Definition: open62541.c:3735
UA_NodeId addedNodeId
Definition: open62541.h:3341
UA_DateTime serverTimestamp
Definition: open62541.h:1578
UA_NODE_BASEATTRIBUTES UA_Byte eventNotifier
Definition: open62541.c:3528
UA_String UA_XmlElement
XmlElement ^^^^^^^^^^ An XML element.
Definition: open62541.h:1154
NodeAttributes ^^^^^^^^^^^^^^ The base attributes for all nodes.
Definition: open62541.h:3955
NotificationMessage ^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:3373
UA_ExpandedNodeId parentNodeId
Definition: open62541.h:4814
#define UA_TYPES_REPUBLISHREQUEST
Definition: open62541.h:4458
#define SOCKET
Definition: open62541.c:26740
#define UA_STATUSCODE_BADSECURECHANNELIDINVALID
Definition: open62541.h:689
UA_UInt32 userWriteMask
Definition: open62541.h:3355
#define UA_USEC_TO_DATETIME
Definition: open62541.h:1073
#define UA_NS0ID_PROPERTYTYPE
Definition: open62541.h:1852
UA_UInt16 availableContinuationPoints
Definition: open62541.c:3739
void Service_CloseSession(UA_Server *server, UA_Session *session, const UA_CloseSessionRequest *request, UA_CloseSessionResponse *response)
Definition: open62541.c:20050
#define UA_TYPES_BROWSEPATHRESULT
Definition: open62541.h:4269
#define UA_TRANSPORT_SYMMETRICALGORITHMSECURITYHEADER
Definition: open62541.c:2657
#define UA_NS0ID_HASTYPEDEFINITION
Definition: open62541.h:1835
#define UA_MINMESSAGESIZE
Definition: open62541.c:24762
#define UA_PRINTF_STRING_DATA(STRING)
Definition: open62541.h:9732
#define UA_NS0ID_HIERARCHICALREFERENCES
Definition: open62541.h:1828
UA_BrowsePathTarget * targets
Definition: open62541.h:4266
Networking Client-server connection is represented by a UA_Connection structure.
Definition: open62541.h:9449
#define UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO
Definition: open62541.h:2544
#define UA_NS0ID_TYPESFOLDER
Definition: open62541.h:1864
#define UA_NS0ID_SERVER_SERVERDIAGNOSTICS_ENABLEDFLAG
Definition: open62541.h:2571
UA_WriteValue * nodesToWrite
Definition: open62541.h:4413
#define UA_TYPES_DELETENODESITEM
Definition: open62541.h:3856
UA_DataValue UA_Server_read(UA_Server *server, const UA_ReadValueId *item, UA_TimestampsToReturn timestamps)
Reading and Writing Node Attributes The functions for reading and writing node attributes call the re...
Definition: open62541.c:20950
UA_NodeId startingNode
Definition: open62541.h:5015
#define UA_STATUSCODE_BADTOOMANYARGUMENTS
Definition: open62541.h:699
UA_UInt32 attributeId
Definition: open62541.h:3875
#define UA_NS0ID_CREATESUBSCRIPTIONREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2385
DataChangeFilter ^^^^^^^^^^^^^^^^.
Definition: open62541.h:4872
UA_MonitoredItemCreateRequest * itemsToCreate
Definition: open62541.h:4950
UA_ClientConfig config
Definition: open62541.c:4737
#define UA_STATUSCODE_BADBOUNDNOTFOUND
Definition: open62541.h:837
MethodAttributes ^^^^^^^^^^^^^^^^ The attributes for a method node.
Definition: open62541.h:3602
UnregisterNodesRequest ^^^^^^^^^^^^^^^^^^^^^^ Unregisters one or more previously registered nodes...
Definition: open62541.h:3513
#define UA_NS0ID_BYTESTRING
Definition: open62541.h:1810
UA_NodeClass nodeClass
Definition: open62541.h:4577
#define UA_STATUSCODE_BADNOCOMMUNICATION
Definition: open62541.h:704
UA_ByteString byteString
Definition: open62541.h:1178
#define UA_TYPES_SERVERSTATUSDATATYPE
Definition: open62541.h:4838
#define UA_STATUSCODE_BADTIMESTAMPSTORETURNINVALID
Definition: open62541.h:697
#define UA_NS0ID_DOUBLE
Definition: open62541.h:1806
#define UA_TYPES_DATACHANGENOTIFICATION
Definition: open62541.h:4512
#define UA_LOCALIZEDTEXT_ENCODINGMASKTYPE_TEXT
Definition: open62541.c:6637
#define UA_STRING_STATIC_NULL
Definition: open62541.c:27604
#define UA_STATUSCODE_BADINVALIDARGUMENT
Definition: open62541.h:866
void Service_SetMonitoringMode(UA_Server *server, UA_Session *session, const UA_SetMonitoringModeRequest *request, UA_SetMonitoringModeResponse *response)
void Service_FindServers(UA_Server *server, UA_Session *session, const UA_FindServersRequest *request, UA_FindServersResponse *response)
Discovery Service Set This Service Set defines Services used to discover the Endpoints implemented by...
Definition: open62541.c:19736
#define UA_STATUSCODE_GOODPOSTACTIONFAILED
Definition: open62541.h:856
#define UA_STATUSCODE_UNCERTAINSUBNORMAL
Definition: open62541.h:821
UA_StatusCode(* start)(UA_ServerNetworkLayer *nl, UA_Logger logger)
Definition: open62541.h:9774
#define UA_fd_isset(fd, fds)
Definition: open62541.c:26770
UA_NumericRangeDimension * dimensions
Definition: open62541.h:1348
UA_ResponseHeader responseHeader
Definition: open62541.h:4897
#define UA_STATUSCODE_GOODCOMMUNICATIONEVENT
Definition: open62541.h:862
const UA_calcSizeBinarySignature calcSizeBinaryJumpTable[UA_BUILTIN_TYPES_COUNT+1]
Definition: open62541.c:7537
#define UA_NODESTORE_MINSIZE
Definition: open62541.c:19171
#define UA_NS0ID_NODEID
Definition: open62541.h:1812
UA_StatusCode statusCode
Definition: open62541.h:3444
#define UA_STATUSCODE_BADOBJECTDELETED
Definition: open62541.h:718
UA_Boolean hasNamespaceUri
Definition: open62541.h:1589
#define UA_STATUSCODE_BADTCPENDPOINTURLINVALID
Definition: open62541.h:802
UA_DateTime validTill
Definition: open62541.c:3737
union UA_ExtensionObject::@1 content
UA_StatusCode * results
Definition: open62541.h:4001
UA_SubscriptionState
Definition: open62541.c:3888
UA_ApplicationDescription server
Definition: open62541.h:5070
UA_NodeId nodeId
Definition: open62541.h:3633
#define UA_STATUSCODE_GOODSHUTDOWNEVENT
Definition: open62541.h:863
#define UA_TYPES_TRANSLATEBROWSEPATHSTONODEIDSRESPONSE
Definition: open62541.h:4866
#define UA_STATUSCODE_BADSECURITYMODEREJECTED
Definition: open62541.h:744
#define UA_NS0ID_SERVER_SERVERSTATUS_SHUTDOWNREASON
Definition: open62541.h:2634
UA_Boolean deleteTargetReferences
Definition: open62541.h:3853
UA_NodeId sourceNodeId
Definition: open62541.h:4615
#define UA_TRANSPORT_ASYMMETRICALGORITHMSECURITYHEADER
Definition: open62541.c:2597
TcpHelloMessage ^^^^^^^^^^^^^^^ Hello Message.
Definition: open62541.c:2548
#define UA_STATUSCODE_BADNODECLASSINVALID
Definition: open62541.h:756
UA_Subscription * UA_Subscription_new(UA_Session *session, UA_UInt32 subscriptionID)
ChannelSecurityToken ^^^^^^^^^^^^^^^^^^^^ The token that identifies a set of keys for an active secur...
Definition: open62541.h:3827
UA_Client_Authentication authenticationMethod
Definition: open62541.c:4749
#define UA_TYPES_NODEATTRIBUTES
Definition: open62541.h:3963
#define UA_TYPES_MODIFYMONITOREDITEMSRESPONSE
Definition: open62541.h:4767
#define UA_TYPES_DEADBANDTYPE
Definition: open62541.h:3759
UA_UInt16 month
Definition: open62541.h:1095
Server Configuration The following structure is passed to a new server for configuration.
Definition: open62541.h:9806
#define UA_TYPES_REFERENCETYPEATTRIBUTES
Definition: open62541.h:4380
#define UA_STATUSCODE_BADCERTIFICATEREVOKED
Definition: open62541.h:683
#define UA_NS0ID_CREATEMONITOREDITEMSREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2349
UA_UInt32 writeMask
Definition: open62541.h:3959
#define UA_STATUSCODE_BADNOMATCH
Definition: open62541.h:779
#define UA_STATUSCODE_GOODEDITED
Definition: open62541.h:855
UA_AttributeId
Standard-Defined Constants This section contains numerical and string constants that are defined in t...
Definition: open62541.h:577
#define TAILQ_FIRST(head)
Definition: open62541.c:450
UA_UInt32 data1
Definition: open62541.h:1108
#define UA_TYPES_CALLREQUEST
Definition: open62541.h:3596
ViewAttributes ^^^^^^^^^^^^^^ The attributes for a view node.
Definition: open62541.h:3263
#define UA_ASSERT_RCU_LOCKED()
Definition: open62541.c:4191
#define UA_NS0ID_UINT16
Definition: open62541.h:1800
#define UA_TRANSPORT_SECURECONVERSATIONMESSAGEHEADER
Definition: open62541.c:2668
#define UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO_PRODUCTNAME
Definition: open62541.h:2545
UA_Boolean historizing
Definition: open62541.c:3469
UA_StatusCode status
Definition: open62541.c:781
enum UA_NodeIdType identifierType
Definition: open62541.h:1173
#define UA_STATUSCODE_BADTOOMANYSUBSCRIPTIONS
Definition: open62541.h:789
#define UA_STATUSCODE_BADSEMPAHOREFILEMISSING
Definition: open62541.h:742
UA_NodeId nodeId
Definition: open62541.h:3874
#define UA_STATUSCODE_BADDISCOVERYURLMISSING
Definition: open62541.h:741
UA_BrowseDescription * nodesToBrowse
Definition: open62541.h:5005
#define UA_NS0ID_MODELLINGRULE_MANDATORY
Definition: open62541.h:1858
DeleteNodesItem ^^^^^^^^^^^^^^^ A request to delete a node to the server address space.
Definition: open62541.h:3851
size_t referencesSize
Definition: open62541.h:5028
#define UA_NodeStore_newDataTypeNode()
Definition: open62541.c:4000
UA_CallMethodRequest * methodsToCall
Definition: open62541.h:3593
struct UA_NodeStoreEntry UA_NodeStoreEntry
UA_MessageSecurityMode securityMode
Definition: open62541.h:4292
UA_Boolean isInverse
Definition: open62541.h:3701
#define UA_LOG_ERROR_CHANNEL(LOGGER, CHANNEL, MSG,...)
Definition: open62541.c:3299
UA_MonitoredItemModifyRequest * itemsToModify
Definition: open62541.h:4533
int16_t UA_Int16
Int16 ^^^^^ An integer value between -32 768 and 32 767.
Definition: open62541.h:946
UA_StatusCode UA_EndpointUrl_split(const char *endpointUrl, char *hostname, UA_UInt16 *port, const char **path)
EndpointURL Helper ^^^^^^^^^^^^^^^^^^.
Definition: open62541.c:15090
UA_Boolean includeSubtypes
Definition: open62541.h:4441
#define MAXTIMEOUT
There are four types of job execution:
Definition: open62541.c:17972
UA_UInt16 chunksSoFar
Definition: open62541.c:3226
#define UA_TRANSPORT_CHUNKTYPE
Definition: open62541.c:2647
UA_StatusCode UA_Server_deleteNode(UA_Server *server, const UA_NodeId nodeId, UA_Boolean deleteReferences)
Definition: open62541.c:22425
#define UA_NS0ID_SERVER_SERVERSTATUS_STARTTIME
Definition: open62541.h:2541
#define UA_STATUSCODE_BADCERTIFICATEISSUERTIMEINVALID
Definition: open62541.h:675
void Service_CloseSecureChannel(UA_Server *server, UA_SecureChannel *channel)
Definition: open62541.c:19894
UA_NODE_BASEATTRIBUTES UA_NODE_VARIABLEATTRIBUTES UA_Boolean isAbstract
Definition: open62541.c:3487
QueryDataDescription ^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:5056
#define UA_OPEN62541_VER_MINOR
Definition: open62541.h:40
void * methodHandle
Definition: open62541.c:3514
UA_StatusCode UA_SecureChannelManager_init(UA_SecureChannelManager *cm, UA_Server *server)
Definition: open62541.c:18644
size_t elementsSize
Definition: open62541.h:4658
UA_UInt32 receiveBufferSize
Definition: open62541.c:2550
UA_NodeId authenticationToken
Definition: open62541.h:3301
UA_NODE_BASEATTRIBUTES UA_Boolean isAbstract
Definition: open62541.c:3676
UA_ResponseHeader responseHeader
Definition: open62541.h:4401
#define UA_TYPES_BYTE
Byte ^^^^.
Definition: open62541.h:3103
UA_LocalizedText displayName
Definition: open62541.h:4576
BrowseNextResponse ^^^^^^^^^^^^^^^^^^ Continues one or more browse operations.
Definition: open62541.h:5111
#define UA_NS0ID_BASEOBJECTTYPE
Definition: open62541.h:1848
DeleteReferencesItem ^^^^^^^^^^^^^^^^^^^^ A request to delete a node from the server address space...
Definition: open62541.h:3618
int32_t UA_Int32
Int32 ^^^^^ An integer value between -2 147 483 648 and 2 147 483 647.
Definition: open62541.h:962
void UA_Session_updateLifetime(UA_Session *session)
Definition: open62541.c:15683
#define UA_STATUSCODE_UNCERTAINDOMINANTVALUECHANGED
Definition: open62541.h:857
MonitoredItemCreateResult ^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:3645
UA_StatusCode serviceResult
Definition: open62541.h:3904
#define UA_STATUSCODE_BADSECURECHANNELCLOSED
Definition: open62541.h:805
UA_ConnectionConfig localConf
Definition: open62541.h:9480
UA_DateTime UA_DateTime_nowMonotonic(void)
Definition: open62541.c:27505
UA_String encryptionAlgorithm
Definition: open62541.h:4027
UA_UInt16 namespaceIndex
Definition: open62541.h:1172
UA_ExpandedNodeId targetId
Definition: open62541.h:3702
const UA_String UA_STRING_NULL
Definition: open62541.c:4784
#define UA_STATUSCODE_GOODRESULTSMAYBEINCOMPLETE
Definition: open62541.h:774
UA_ByteString * continuationPoints
Definition: open62541.h:4218
UA_UInt32 UA_UInt32_random(void)
Definition: open62541.c:4814
#define UA_TYPES_MONITORINGPARAMETERS
Definition: open62541.h:3682
UA_ExpandedNodeId nodeId
Definition: open62541.h:4574
ExpandedNodeId ^^^^^^^^^^^^^^ A NodeId that allows the namespace URI to be specified instead of an in...
Definition: open62541.h:1238
UA_UInt32 writeMask
Definition: open62541.h:4426
ParsingResult ^^^^^^^^^^^^^.
Definition: open62541.h:3459
UA_UInt16 addNamespace(UA_Server *server, const UA_String name)
Definition: open62541.c:15766
#define UA_PRINTF_GUID_FORMAT
Convenience macros for complex types ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:9726
CallMethodRequest ^^^^^^^^^^^^^^^^^.
Definition: open62541.h:3500
void Service_DeleteSubscriptions(UA_Server *server, UA_Session *session, const UA_DeleteSubscriptionsRequest *request, UA_DeleteSubscriptionsResponse *response)
UA_Boolean isAbstract
Definition: open62541.h:3892
UA_UInt32 maxNotificationsPerPublish
Definition: open62541.h:4232
UA_UInt32 sendBufferSize
Definition: open62541.h:9451
Definition: open62541.c:3209
#define UA_STATUSCODE_BADPROTOCOLVERSIONUNSUPPORTED
Definition: open62541.h:808
#define UA_STATUSCODE_BADSEQUENCENUMBERUNKNOWN
Definition: open62541.h:792
#define UA_realloc(ptr, size)
Definition: open62541.h:105
ObjectNode
Definition: open62541.c:3526
#define WIN32_INT
Definition: open62541.c:26741
UA_RequestHeader requestHeader
Definition: open62541.h:4480
#define UA_NS0ID_STATUSCODE
Definition: open62541.h:1814
UA_ExpandedNodeId targetNodeId
Definition: open62541.h:4619
UA_ByteString serverCertificate
Definition: open62541.h:5157
ActivateSessionResponse ^^^^^^^^^^^^^^^^^^^^^^^ Activates a session with the server.
Definition: open62541.h:4144
VariableAttributes ^^^^^^^^^^^^^^^^^^ The attributes for a variable node.
Definition: open62541.h:3350
#define UA_STATUSCODE_BADSERVERINDEXINVALID
Definition: open62541.h:768
UA_IdType
IdType ^^^^^^ The type of identifier used in a node id.
Definition: open62541.h:4036
UA_StatusCode UA_Subscription_removeRetransmissionMessage(UA_Subscription *sub, UA_UInt32 sequenceNumber)
void UA_random_seed(UA_UInt64 seed)
Random Number Generator If UA_ENABLE_MULTITHREADING is defined, then the seed is stored in thread loc...
Definition: open62541.c:4809
UA_ResponseHeader responseHeader
Definition: open62541.h:4588
#define UA_STATUSCODE_BADREQUESTTYPEINVALID
Definition: open62541.h:743
#define UA_TYPES_SERVICEFAULT
Definition: open62541.h:4927
UA_DateTime currentTime
Definition: open62541.h:4831
#define UA_TYPES_APPLICATIONTYPE
Definition: open62541.h:4106
UA_StatusCode UA_NodeStore_replace(UA_NodeStore *ns, UA_Node *node)
Definition: open62541.c:19430
UA_Boolean deleteSubscriptions
Definition: open62541.h:4317
const char * LogLevelNames[6]
Definition: open62541.c:27544
UA_ChunkType
ChunkType ^^^^^^^^^ Type of the chunk.
Definition: open62541.c:2639
UA_UInt16 serverPicoseconds
Definition: open62541.h:1579
UA_ApplicationDescription clientDescription
Definition: open62541.c:3729
WriteResponse ^^^^^^^^^^^^^.
Definition: open62541.h:4200
SubscriptionAcknowledgement ^^^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:3862
void UA_Server_delete(UA_Server *server)
Definition: open62541.c:15885
UA_Double minimumSamplingInterval
Definition: open62541.h:3363
UA_StatusCode UA_Variant_setArrayCopy(UA_Variant *v, const void *array, size_t arraySize, const UA_DataType *type)
Definition: open62541.c:5202
#define UA_STATUSCODE_BADSYNTAXERROR
Definition: open62541.h:877
#define UA_TYPES_MONITOREDITEMNOTIFICATION
Definition: open62541.h:3845
#define UA_STATUSCODE_BADREFERENCENOTALLOWED
Definition: open62541.h:753
UA_CallMethodResult * results
Definition: open62541.h:4699
#define UA_NS0ID_SERVER_SERVERSTATUS_CURRENTTIME
Definition: open62541.h:2542
UserIdentityToken ^^^^^^^^^^^^^^^^^ A base type for a user identity token.
Definition: open62541.h:3726
UA_Boolean isForward
Definition: open62541.h:4617
#define DOUBLE_NEG_INF
Definition: open62541.c:6213
UA_StatusCode(* send)(UA_Connection *connection, UA_ByteString *buf)
Definition: open62541.h:9504
UA_StatusCode UA_Client_addReference(UA_Client *client, const UA_NodeId sourceNodeId, const UA_NodeId referenceTypeId, UA_Boolean isForward, const UA_String targetServerUri, const UA_ExpandedNodeId targetNodeId, UA_NodeClass targetNodeClass)
Definition: open62541.c:25612
#define UA_NS0ID_ACTIVATESESSIONREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2065
#define UA_TYPES_DATACHANGETRIGGER
Definition: open62541.h:3786
#define UA_STATUSCODE_BADSEQUENCENUMBERINVALID
Definition: open62541.h:807
QueryNextResponse ^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4131
UA_NodeAttributesMask
NodeAttributesMask ^^^^^^^^^^^^^^^^^^ The bits used to specify default attributes for a new node...
Definition: open62541.h:3386
#define UA_TYPES_VARIABLEATTRIBUTES
Definition: open62541.h:3367
#define UA_NS0ID_DELETEMONITOREDITEMSREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2379
UA_Boolean releaseContinuationPoints
Definition: open62541.h:4216
#define UA_TYPES_CALLMETHODREQUEST
Definition: open62541.h:3507
#define UA_NODEIDTYPE_NUMERIC_FOURBYTE
Definition: open62541.c:6459
#define UA_STATUSCODE_BADOUTOFMEMORY
Definition: open62541.h:654
UA_LocalizedText inverseName
Definition: open62541.c:3657
#define UA_STATUSCODE_BADCONDITIONBRANCHALREADYACKED
Definition: open62541.h:831
#define UA_NodeStore_newObjectNode()
Definition: open62541.c:3990
#define UA_TYPES_CHANNELSECURITYTOKEN
Definition: open62541.h:3834
UA_MethodCallback attachedMethod
Definition: open62541.c:3515
#define UA_TYPES_BOOLEAN
Boolean ^^^^^^^.
Definition: open62541.h:3091
#define UA_STATUSCODE_BADSESSIONNOTACTIVATED
Definition: open62541.h:694
#define UA_STATUSCODE_GOODCOMPLETESASYNCHRONOUSLY
Definition: open62541.h:701
#define SIMPLEQ_REMOVE_HEAD(head, field)
Definition: open62541.c:338
#define UA_NS0ID_SERVER_SERVERARRAY
Definition: open62541.h:2538
UA_ResponseHeader responseHeader
Definition: open62541.h:4711
#define UA_STATUSCODE_BADMAXCONNECTIONSREACHED
Definition: open62541.h:878
UA_MonitoredItem * UA_Subscription_getMonitoredItem(UA_Subscription *sub, UA_UInt32 monitoredItemID)
#define UA_TYPES_BROWSEDESCRIPTION
Definition: open62541.h:4446
#define UA_TYPES_CONTENTFILTERELEMENTRESULT
Definition: open62541.h:3533
#define UA_STATUSCODE_BADBOUNDNOTSUPPORTED
Definition: open62541.h:838
#define UA_TYPES_REFERENCENODE
Definition: open62541.h:3705
UA_UInt32 userWriteMask
Definition: open62541.h:4427
#define UA_NODEIDTYPE_NUMERIC_COMPLETE
Definition: open62541.c:6460
#define UA_STATUSCODE_BADCERTIFICATEISSUERREVOCATIONUNKNOWN
Definition: open62541.h:682
void UA_Subscription_deleteMembers(UA_Subscription *subscription, UA_Server *server)
#define UA_STATUSCODE_BADSERVICEUNSUPPORTED
Definition: open62541.h:664
UA_UInt32 maxNotificationsPerPublish
Definition: open62541.h:4332
Guid ^^^^ A 16 byte value that can be used as a globally unique identifier.
Definition: open62541.h:1107
UA_MessageSecurityMode
MessageSecurityMode ^^^^^^^^^^^^^^^^^^^ The type of security to use on a message. ...
Definition: open62541.h:3659
UA_UInt16 microSec
Definition: open62541.h:1089
UA_StatusCode UA_Node_copyAnyNodeClass(const UA_Node *src, UA_Node *dst)
Definition: open62541.c:19094
UA_Boolean hasSymbolicId
Definition: open62541.h:1588
String ^^^^^^ A sequence of Unicode characters.
Definition: open62541.h:1038
#define UA_STATUSCODE_BADRESOURCEUNAVAILABLE
Definition: open62541.h:655
const UA_Node * UA_NodeStore_get(UA_NodeStore *ns, const UA_NodeId *nodeid)
Definition: open62541.c:19446
MonitoringParameters ^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:3674
#define SIMPLEQ_HEAD(name, type)
Definition: open62541.c:280
UA_DeadbandType
DeadbandType ^^^^^^^^^^^^.
Definition: open62541.h:3751
UA_Int32 valueRank
Definition: open62541.h:3714
UA_ResponseHeader responseHeader
Definition: open62541.h:5138
#define UA_TYPES_MONITOREDITEMMODIFYRESULT
Definition: open62541.h:3323
#define UA_assert(ignore)
Definition: open62541.c:744
#define UA_NS0ID_DELETESUBSCRIPTIONSREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2439
#define SIMPLEQ_INIT(head)
Definition: open62541.c:315
#define UA_TRANSPORT_SECURECONVERSATIONMESSAGEFOOTER
Definition: open62541.c:2542
void UA_Connection_attachSecureChannel(UA_Connection *connection, UA_SecureChannel *channel)
Definition: open62541.c:15018
type_equivalence
Definition: open62541.c:20080
UA_StatusCode UA_Server_setObjectTypeNode_lifecycleManagement(UA_Server *server, UA_NodeId nodeId, UA_ObjectLifecycleManagement olm)
Definition: open62541.c:22590
UA_NodeId authenticationToken
Definition: open62541.c:3732
#define UA_TYPES_VIEWATTRIBUTES
Definition: open62541.h:3273
#define UA_STATUSCODE_BADTOOMANYPUBLISHREQUESTS
Definition: open62541.h:790
UA_RequestHeader requestHeader
Definition: open62541.h:5039
size_t(* stop)(UA_ServerNetworkLayer *nl, UA_Job **jobs)
Definition: open62541.h:9796
UA_UInt32 receiveSequenceNumber
Definition: open62541.c:3240
#define UA_STATUSCODE_BADNODELETERIGHTS
Definition: open62541.h:766
#define UA_STATUSCODE_BADPARENTNODEIDINVALID
Definition: open62541.h:752
UA_String discoveryUrl
Definition: open62541.h:9767
DeleteMonitoredItemsRequest ^^^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4356
#define UA_STATUSCODE_BADEVENTNOTACKNOWLEDGEABLE
Definition: open62541.h:828
UA_StatusCode UA_Connection_completeMessages(UA_Connection *connection, UA_ByteString *message, UA_Boolean *realloced)
Definition: open62541.c:14876
#define UA_NS0ID_SERVER_SERVERCAPABILITIES_AGGREGATEFUNCTIONS
Definition: open62541.h:2637
#define UA_STATUSCODE_BADNONCEINVALID
Definition: open62541.h:691
UA_Boolean UA_NodeId_isNull(const UA_NodeId *p)
Definition: open62541.c:4994
UA_StatusCode statusCode
Definition: open62541.h:3340
void UA_Node_deleteMembersAnyNodeClass(UA_Node *node)
Definition: open62541.c:18963
#define UA_TYPES_LOCALIZEDTEXT
LocalizedText ^^^^^^^^^^^^^.
Definition: open62541.h:3211
AddReferencesResponse ^^^^^^^^^^^^^^^^^^^^^ Adds one or more references to the server address space...
Definition: open62541.h:4844
const UA_EXPORT UA_ServerConfig UA_ServerConfig_standard
Definition: open62541.c:27614
UA_Byte membersSize
Definition: open62541.h:1657
UA_Boolean hasStatus
Definition: open62541.h:1569
UA_StatusCode(* UA_NodeIteratorCallback)(UA_NodeId childId, UA_Boolean isInverse, UA_NodeId referenceTypeId, void *handle)
Definition: open62541.h:10250
UA_Boolean userExecutable
Definition: open62541.h:3609
UA_Double requestedPublishingInterval
Definition: open62541.h:4329
#define UA_TYPES_TRANSLATEBROWSEPATHSTONODEIDSREQUEST
Definition: open62541.h:5131
UA_ConnectionConfig remoteConf
Definition: open62541.h:9481
UA_BrowseResult UA_Server_browseNext(UA_Server *server, UA_Boolean releaseContinuationPoint, const UA_ByteString *continuationPoint)
Definition: open62541.c:22962
const UA_Node * getNodeType(UA_Server *server, const UA_Node *node)
Definition: open62541.c:17837
#define UA_TYPES_RESPONSEHEADER
Definition: open62541.h:3911
UA_StatusCode UA_Server_run_shutdown(UA_Server *server)
Definition: open62541.c:18588
#define UA_STATUSCODE_BADIDENTITYTOKENREJECTED
Definition: open62541.h:688
#define UA_NODE_VARIABLEATTRIBUTES
Definition: open62541.c:3446
#define UA_STATUSCODE_BADSESSIONCLOSED
Definition: open62541.h:693
UA_ResponseHeader responseHeader
Definition: open62541.h:4669
#define DOUBLE_NAN
Definition: open62541.c:6211
#define UA_STATUSCODE_GOOD
Definition: open62541.h:651
UA_String locale
Definition: open62541.h:1314
#define UA_STATUSCODE_BADNOTTYPEDEFINITION
Definition: open62541.h:775
#define UA_STATUSCODE_BADNOTHINGTODO
Definition: open62541.h:668
Definition: open62541.c:19173
#define UA_NS0ID_REGISTERNODESREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2158
UA_Guid guid
Definition: open62541.h:1177
#define UA_STATUSCODE_GOODCLAMPED
Definition: open62541.h:703
UA_NodeId nodeId
Definition: open62541.h:1239
UA_EXPORT const UA_DataType UA_TRANSPORT[UA_TRANSPORT_COUNT]
Definition: open62541.c:14692
struct UA_SecureChannelManager UA_SecureChannelManager
UA_ExpandedNodeId requestedNewNodeId
Definition: open62541.h:4816
#define UA_STATUSCODE_BADNOTREADABLE
Definition: open62541.h:713
UA_StatusCode UA_Variant_setScalarCopy(UA_Variant *v, const void *p, const UA_DataType *type)
Definition: open62541.c:5177
#define UA_RCU_LOCK()
Definition: open62541.c:4189
void UA_SecureChannel_detachSession(UA_SecureChannel *channel, UA_Session *session)
Definition: open62541.c:15237
#define UA_TYPES_UNREGISTERNODESRESPONSE
Definition: open62541.h:4404
void Service_ModifySubscription(UA_Server *server, UA_Session *session, const UA_ModifySubscriptionRequest *request, UA_ModifySubscriptionResponse *response)
#define WOULDBLOCK
Definition: open62541.c:26788
#define UA_NS0ID_SERVER_SERVERCAPABILITIES_MAXHISTORYCONTINUATIONPOINTS
Definition: open62541.h:2613
UA_StatusCode typeCheckValue(UA_Server *server, const UA_NodeId *targetDataTypeId, UA_Int32 targetValueRank, size_t targetArrayDimensionsSize, const UA_UInt32 *targetArrayDimensions, const UA_Variant *value, const UA_NumericRange *range, UA_Variant *editableValue)
Definition: open62541.c:20208
#define UA_NS0ID_ROOTFOLDER
Definition: open62541.h:1862
UA_ResponseHeader responseHeader
Definition: open62541.h:3942
UA_StatusCode UA_Client_getEndpoints(UA_Client *client, const char *serverUrl, size_t *endpointDescriptionsSize, UA_EndpointDescription **endpointDescriptions)
Definition: open62541.c:25250
int8_t UA_SByte
SByte ^^^^^ An integer value between -128 and 127.
Definition: open62541.h:930
#define UA_NS0ID_SERVER_SERVERCAPABILITIES_LOCALEIDARRAY
Definition: open62541.h:2554
UA_Boolean UA_NodeId_equal(const UA_NodeId *n1, const UA_NodeId *n2)
Definition: open62541.c:5019
#define UA_TYPES_FILTEROPERATOR
Definition: open62541.h:4182
#define UA_TYPES_CLOSESECURECHANNELREQUEST
Definition: open62541.h:3333
#define UA_NS0ID_SETMONITORINGMODEREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2367
CloseSessionRequest ^^^^^^^^^^^^^^^^^^^ Closes a session with the server.
Definition: open62541.h:4315
#define UA_STATUSCODE_BADCERTIFICATETIMEINVALID
Definition: open62541.h:674
ReadResponse ^^^^^^^^^^^^.
Definition: open62541.h:4773
#define UA_STATUSCODE_GOODSUBSCRIPTIONTRANSFERRED
Definition: open62541.h:700
UA_BrowseDirection
BrowseDirection ^^^^^^^^^^^^^^^ The directions of the references to return.
Definition: open62541.h:3486
#define UA_NS0ID_DATETIME
Definition: open62541.h:1808
WriteRequest ^^^^^^^^^^^^.
Definition: open62541.h:4410
const UA_StatusCodeDescription * UA_StatusCode_description(UA_StatusCode code)
Definition: open62541.c:26694
UA_StatusCode MonitoredItem_unregisterSampleJob(UA_Server *server, UA_MonitoredItem *mon)
#define UA_TYPES_VIEWDESCRIPTION
Definition: open62541.h:3935
UA_ConnectionConfig conf
Definition: open62541.c:26968
void UA_NodeStore_delete(UA_NodeStore *ns)
Definition: open62541.c:19362
#define UA_TYPES_QUERYFIRSTREQUEST
Definition: open62541.h:5182
#define UA_NS0ID_SERVER_SERVERSTATUS
Definition: open62541.h:2540
#define UA_NS0ID_STRUCTURE
Definition: open62541.h:1817
UA_StatusCode parse_numericrange(const UA_String *str, UA_NumericRange *range)
Definition: open62541.c:17682
UA_Boolean isArray
Definition: open62541.h:1647
#define UA_STATUSCODE_BADUSERACCESSDENIED
Definition: open62541.h:686
#define UA_STATUSCODE_UNCERTAINNOTALLNODESAVAILABLE
Definition: open62541.h:773
#define UA_NS0ID_SETPUBLISHINGMODEREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2397
UA_StatusCode writeValueRankAttribute(UA_Server *server, UA_VariableNode *node, UA_Int32 valueRank, UA_Int32 constraintValueRank)
Definition: open62541.c:20347
void Service_AddNodes(UA_Server *server, UA_Session *session, const UA_AddNodesRequest *request, UA_AddNodesResponse *response)
NodeManagement Service Set This Service Set defines Services to add and delete AddressSpace Nodes and...
Definition: open62541.c:22024
UA_StatusCode __UA_Client_addNode(UA_Client *client, const UA_NodeClass nodeClass, const UA_NodeId requestedNewNodeId, const UA_NodeId parentNodeId, const UA_NodeId referenceTypeId, const UA_QualifiedName browseName, const UA_NodeId typeDefinition, const UA_NodeAttributes *attr, const UA_DataType *attributeType, UA_NodeId *outNewNodeId)
Definition: open62541.c:25702
#define UA_UINT32_MAX
Definition: open62541.h:972
#define UA_STATUSCODE_BADDATAENCODINGUNSUPPORTED
Definition: open62541.h:712
ActivateSessionRequest ^^^^^^^^^^^^^^^^^^^^^^ Activates a session with the server.
Definition: open62541.h:4067
UA_NodeClass nodeClass
Definition: open62541.h:4818
#define FLOAT_NEG_INF
Definition: open62541.c:6178
#define UA_STATUSCODE_BADCONNECTIONCLOSED
Definition: open62541.h:869
UA_SecureChannel * channel
Definition: open62541.c:3223
UA_Byte * data
Definition: open62541.h:1040
UA_StatusCode UA_SecureChannel_sendBinaryMessage(UA_SecureChannel *channel, UA_UInt32 requestId, const void *content, const UA_DataType *contentType)
Definition: open62541.c:15348
#define UA_STATUSCODE_GOODENTRYINSERTED
Definition: open62541.h:844
#define UA_STATUSCODE_BADCOMMUNICATIONERROR
Definition: open62541.h:656
#define UA_TYPES_STATUSCODE
StatusCode ^^^^^^^^^^.
Definition: open62541.h:3199
ResponseHeader ^^^^^^^^^^^^^^ The header passed with every server response.
Definition: open62541.h:3901
void UA_SessionManager_deleteMembers(UA_SessionManager *sm)
Definition: open62541.c:18838
size_t(* UA_calcSizeBinarySignature)(const void *UA_RESTRICT p, const UA_DataType *contenttype)
Definition: open62541.c:5874
void * data
Definition: open62541.h:1403
#define UA_TYPES_BROWSEDIRECTION
Definition: open62541.h:3494
void * instanceHandle
Definition: open62541.c:3531
CloseSecureChannelRequest ^^^^^^^^^^^^^^^^^^^^^^^^^ Closes a secure channel.
Definition: open62541.h:3329
#define UA_STATUSCODE_BADREQUESTHEADERINVALID
Definition: open62541.h:696
#define UA_TYPES_REGISTERNODESREQUEST
Definition: open62541.h:3975
#define UA_TYPES_EXTENSIONOBJECT
ExtensionObject ^^^^^^^^^^^^^^^.
Definition: open62541.h:3217
#define UA_NS0ID_SERVER_SERVERCAPABILITIES_MODELLINGRULES
Definition: open62541.h:2636
#define UA_TYPES_UNREGISTERNODESREQUEST
Definition: open62541.h:3519
#define PCG32_INITIALIZER
Definition: open62541.c:716
UA_SessionManager sessionManager
Definition: open62541.c:4220
UA_ResponseHeader responseHeader
Definition: open62541.h:4543
UA_UInt32 requestedMaxKeepAliveCount
Definition: open62541.h:4331
SetMonitoringModeResponse ^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4542
#define UA_TYPES_BROWSERESULT
Definition: open62541.h:5032
ServerStatusDataType ^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4829
UA_ByteString serverNonce
Definition: open62541.c:3239
void(* releaseSendBuffer)(UA_Connection *connection, UA_ByteString *buf)
Definition: open62541.h:9496
UA_UInt32 count
Definition: open62541.c:19183
UA_Connection * closeConnection
Definition: open62541.h:9587
#define LIST_FOREACH_SAFE(var, head, field, tvar)
Definition: open62541.c:224
void Service_DeleteReferences(UA_Server *server, UA_Session *session, const UA_DeleteReferencesRequest *request, UA_DeleteReferencesResponse *response)
Definition: open62541.c:22488
UA_UInt32 UA_NodeId_hash(const UA_NodeId *n)
Definition: open62541.c:5055
void Service_GetEndpoints(UA_Server *server, UA_Session *session, const UA_GetEndpointsRequest *request, UA_GetEndpointsResponse *response)
Definition: open62541.c:19774
UA_NodeId referenceTypeId
Definition: open62541.h:4815
UA_StatusCode UA_Variant_setRange(UA_Variant *v, void *UA_RESTRICT array, size_t arraySize, const UA_NumericRange range)
Definition: open62541.c:5498
size_t methodsToCallSize
Definition: open62541.h:3592
UA_NodeId typeId
Definition: open62541.h:1654
#define UA_STATUSCODE_BADSECURITYMODEINSUFFICIENT
Definition: open62541.h:781
BrowsePath ^^^^^^^^^^ A request to translate a path into a node id.
Definition: open62541.h:5014
#define UA_TYPES_QUERYNEXTRESPONSE
Definition: open62541.h:4138
DeleteSubscriptionsResponse ^^^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4643
RelativePathElement ^^^^^^^^^^^^^^^^^^^ An element in a relative path.
Definition: open62541.h:3473
#define UA_STATUSCODE_BADSECURITYCHECKSFAILED
Definition: open62541.h:673
UA_LocalizedText displayName
Definition: open62541.h:3957
UA_NotificationMessage notificationMessage
Definition: open62541.h:3999
UA_FilterOperator
FilterOperator ^^^^^^^^^^^^^^.
Definition: open62541.h:4159
#define UA_STATUSCODE_BADCONDITIONNOTSHELVED
Definition: open62541.h:834
#define UA_TYPES_MONITOREDITEMCREATERESULT
Definition: open62541.h:3653
UA_String string
Definition: open62541.h:1176
#define UA_calloc(num, size)
Definition: open62541.h:104
uint8_t UA_Byte
Byte ^^^^ An integer value between 0 and 255.
Definition: open62541.h:938
BrowseResult ^^^^^^^^^^^^ The result of a browse operation.
Definition: open62541.h:5025
UA_DateTimeStruct UA_DateTime_toStruct(UA_DateTime t)
Definition: open62541.c:4857
void UA_Session_init(UA_Session *session)
Definition: open62541.c:15633
#define UA_STATUSCODE_BADMETHODINVALID
Definition: open62541.h:787
SecureConversationMessageHeader ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Secure Layer Sequence Header...
Definition: open62541.c:2663
#define UA_STATUSCODE_BADSENSORFAILURE
Definition: open62541.h:812
#define FLOAT_NAN
Definition: open62541.c:6176
#define UA_STATUSCODE_BADCERTIFICATEREVOCATIONUNKNOWN
Definition: open62541.h:681
void UA_SecureChannel_deleteMembersCleanup(UA_SecureChannel *channel)
Definition: open62541.c:15174
UA_String name
Definition: open62541.h:3712
#define UA_BYTE_MAX
Definition: open62541.h:940
size_t nodesToBrowseSize
Definition: open62541.h:5004
UA_String indexRange
Definition: open62541.h:3876
#define UA_STATUSCODE_BADFILTEROPERANDCOUNTMISMATCH
Definition: open62541.h:730
#define UA_NS0ID_HASNOTIFIER
Definition: open62541.h:1841
#define UA_TYPES_DELETEREFERENCESREQUEST
Definition: open62541.h:4753
UA_QualifiedName dataEncoding
Definition: open62541.h:3877
UA_Boolean namespaceZero
Definition: open62541.h:1642
#define UA_STATUSCODE_BADAGGREGATENOTSUPPORTED
Definition: open62541.h:850
UA_UInt32 maxChunkCount
Definition: open62541.c:2553
#define DAYS_PER_4Y
Definition: open62541.c:26328
VariableTypeAttributes ^^^^^^^^^^^^^^^^^^^^^^ The attributes for a variable type node.
Definition: open62541.h:4243
UA_Boolean hasInnerStatusCode
Definition: open62541.h:1593
#define UA_TYPES_NOTIFICATIONMESSAGE
Definition: open62541.h:3380
UA_String namespaceUri
Definition: open62541.h:1240
#define UA_TYPES_TIMESTAMPSTORETURN
Definition: open62541.h:3584
UA_ReferenceDescription * references
Definition: open62541.h:5029
#define UA_STATUSCODE_BADNOSUBSCRIPTION
Definition: open62541.h:791
UA_StatusCode(* getSendBuffer)(UA_Connection *connection, size_t length, UA_ByteString *buf)
Definition: open62541.h:9492
CloseSecureChannelResponse ^^^^^^^^^^^^^^^^^^^^^^^^^^ Closes a secure channel.
Definition: open62541.h:4518
Definition: open62541.c:3882
#define UA_TYPES_SECURITYTOKENREQUESTTYPE
Definition: open62541.h:3772
UA_AddNodesResult * results
Definition: open62541.h:4494
#define UA_NS0ID_UINT32
Definition: open62541.h:1802
#define DAYS_PER_100Y
Definition: open62541.c:26327
#define PRODUCT_NAME
Definition: open62541.c:27598
#define UA_STATUSCODE_BADUNEXPECTEDERROR
Definition: open62541.h:652
UA_StatusCode status
Definition: open62541.h:1575
#define UA_TYPES_DELETESUBSCRIPTIONSREQUEST
Definition: open62541.h:3923
#define UA_STATUSCODE_BADWRITENOTSUPPORTED
Definition: open62541.h:785
#define UA_NS0ID_GUID
Definition: open62541.h:1809
#define UA_NS0ID_SERVER_SERVERCAPABILITIES_SOFTWARECERTIFICATES
Definition: open62541.h:2657
UA_Boolean hasAdditionalInfo
Definition: open62541.h:1592
UA_ByteString clientNonce
Definition: open62541.h:5044
UA_UInt32 sizePrimeIndex
Definition: open62541.c:19184
ViewNode
Definition: open62541.c:3688
#define UA_EXPANDEDNODEID_NAMESPACEURI_FLAG
Definition: open62541.c:6463
#define UA_NS0ID_BUILDINFOTYPE
Definition: open62541.h:2646
UA_ResponseHeader responseHeader
Definition: open62541.h:4683
#define UA_STATUSCODE_BADWAITINGFORRESPONSE
Definition: open62541.h:873
UA_NODE_BASEATTRIBUTES UA_Byte eventNotifier
Definition: open62541.c:3690
UA_Boolean hasLocale
Definition: open62541.h:1591
#define UA_TYPES_ANONYMOUSIDENTITYTOKEN
Definition: open62541.h:3556
void UA_delete(void *p, const UA_DataType *type)
Definition: open62541.c:5756
UA_ServerState
ServerState ^^^^^^^^^^^.
Definition: open62541.h:4112
UA_UInt32 * availableSequenceNumbers
Definition: open62541.h:3997
#define UA_STATUSCODE_BADUNKNOWNRESPONSE
Definition: open62541.h:662
void UA_Subscription_answerPublishRequestsNoSubscription(UA_Server *server, UA_NodeId *sessionToken)
GetEndpointsRequest ^^^^^^^^^^^^^^^^^^^ Gets the endpoints used by the server.
Definition: open62541.h:4464
void Service_AddReferences(UA_Server *server, UA_Session *session, const UA_AddReferencesRequest *request, UA_AddReferencesResponse *response)
Definition: open62541.c:22319
#define UA_NS0ID_HASHISTORICALCONFIGURATION
Definition: open62541.h:1847
UA_StatusCode(* UA_copySignature)(const void *src, void *dst, const UA_DataType *type)
Definition: open62541.c:5616
void pcg32_srandom_r(pcg32_random_t *rng, uint64_t initial_state, uint64_t initseq)
Definition: open62541.c:26428
UA_ExpandedNodeId targetNodeId
Definition: open62541.h:3622
UA_Boolean hasServerPicoseconds
Definition: open62541.h:1573
#define SLIST_INIT(head)
Definition: open62541.c:158
#define UA_TYPES_RELATIVEPATHELEMENT
Definition: open62541.h:3480
UA_ExtensionObject * notificationData
Definition: open62541.h:3377
AddNodesResult ^^^^^^^^^^^^^^ A result of an add node operation.
Definition: open62541.h:3339
#define UA_TYPES_DOUBLE
Double ^^^^^^.
Definition: open62541.h:3151
#define LIST_INSERT_AFTER(listelm, elm, field)
Definition: open62541.c:236
void(* releaseRecvBuffer)(UA_Connection *connection, UA_ByteString *buf)
Definition: open62541.h:9520
UA_String securityPolicyUri
Definition: open62541.h:5073
UA_ServerNetworkLayer UA_ServerNetworkLayerTCP(UA_ConnectionConfig conf, UA_UInt16 port)
Definition: open62541.c:27293
#define UA_STATUSCODE_BADCONTENTFILTERINVALID
Definition: open62541.h:727
CreateSessionResponse ^^^^^^^^^^^^^^^^^^^^^ Creates a new session with the server.
Definition: open62541.h:5151
UA_String text
Definition: open62541.h:1315
const UA_ByteString UA_BYTESTRING_NULL
Definition: open62541.c:4785
#define UA_STATUSCODE_BADFILTEROPERATORUNSUPPORTED
Definition: open62541.h:729
#define UA_TYPES_BROWSENEXTRESPONSE
Definition: open62541.h:5119
UA_NodeClass
NodeClass ^^^^^^^^^ A mask specifying the class of the node.
Definition: open62541.h:3807
UA_StatusCode UA_SecureChannelManager_renew(UA_SecureChannelManager *cm, UA_Connection *conn, const UA_OpenSecureChannelRequest *request, UA_OpenSecureChannelResponse *response)
Definition: open62541.c:18767
UA_UInt32 remainingPathIndex
Definition: open62541.h:3254
UA_StatusCode UA_Variant_copyRange(const UA_Variant *src, UA_Variant *dst, const UA_NumericRange range)
Definition: open62541.c:5326
#define UA_TYPES_INT64
Int64 ^^^^^.
Definition: open62541.h:3133
#define UA_NS0ID_AGGREGATES
Definition: open62541.h:1837
#define UA_STATUSCODE_BADSOURCENODEIDINVALID
Definition: open62541.h:761
UA_TimestampsToReturn
TimestampsToReturn ^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:3575
#define UA_NS0ID_EVENTTYPESFOLDER
Definition: open62541.h:2645
UA_StatusCode UA_Server_addRepeatedJob(UA_Server *server, UA_Job job, UA_UInt32 interval, UA_Guid *jobId)
Repeated jobs
Definition: open62541.c:18120
RegisterNodesRequest ^^^^^^^^^^^^^^^^^^^^ Registers one or more nodes for repeated use within a sessi...
Definition: open62541.h:3969
EndpointDescription ^^^^^^^^^^^^^^^^^^^ The description of a endpoint that can be used to access a se...
Definition: open62541.h:5068
#define LIST_EMPTY(head)
Definition: open62541.c:216
#define UA_BINARY_OVERLAYABLE_FLOAT
Float Endianness ^^^^^^^^^^^^^^^^ The definition UA_BINARY_OVERLAYABLE_FLOAT is true when the floatin...
Definition: open62541.h:268
UA_LocalizedText description
Definition: open62541.h:4425
ObjectAttributes ^^^^^^^^^^^^^^^^ The attributes for an object node.
Definition: open62541.h:4422
#define UA_NS0ID_SERVER_SERVICELEVEL
Definition: open62541.h:2551
#define UA_TYPES_QUERYNEXTREQUEST
Definition: open62541.h:4194
#define UA_STATUSCODE_BADTCPSERVERTOOBUSY
Definition: open62541.h:796
#define UA_TYPES_ACTIVATESESSIONRESPONSE
Definition: open62541.h:4153
#define UA_TYPES_REQUESTHEADER
Definition: open62541.h:3310
UA_DataTypeMember * members
Definition: open62541.h:1666
UA_ResponseHeader responseHeader
Definition: open62541.h:4725
#define UA_TYPES_UINT16
UInt16 ^^^^^^.
Definition: open62541.h:3115
UA_SecureChannel * channel
Definition: open62541.c:3738
UA_StatusCode UA_encodeBinary(const void *src, const UA_DataType *type, UA_exchangeEncodeBuffer exchangeCallback, void *exchangeHandle, UA_ByteString *dst, size_t *offset) UA_FUNC_ATTR_WARN_UNUSED_RESULT
Definition: open62541.c:7249
#define UA_TYPES_VARIANT
Variant ^^^^^^^.
Definition: open62541.h:3229
void UA_SecureChannelManager_cleanupTimedOut(UA_SecureChannelManager *cm, UA_DateTime nowMonotonic)
Definition: open62541.c:18689
UA_TimestampsToReturn timestampsToReturn
Definition: open62541.h:4948
DeleteReferencesResponse ^^^^^^^^^^^^^^^^^^^^^^^^ Delete one or more references from the server addre...
Definition: open62541.h:4668
#define UA_TYPES_NODECLASS
Definition: open62541.h:3821
#define LIST_INIT(head)
Definition: open62541.c:232
#define UA_STATUSCODE_GOODOVERLOAD
Definition: open62541.h:702
void(* close)(UA_Connection *connection)
Definition: open62541.h:9523
UA_UInt32 requestHandle
Definition: open62541.h:3903
#define UA_FALSE
Definition: open62541.h:924
UA_NODE_BASEATTRIBUTES UA_Boolean executable
Definition: open62541.c:3510
void UA_Variant_setArray(UA_Variant *v, void *UA_RESTRICT array, size_t arraySize, const UA_DataType *type)
Definition: open62541.c:5193
#define UA_STATUSCODE_BADVIEWTIMESTAMPINVALID
Definition: open62541.h:770
void Service_CreateSession(UA_Server *server, UA_SecureChannel *channel, const UA_CreateSessionRequest *request, UA_CreateSessionResponse *response)
Session Service Set This Service Set defines Services for an application layer connection establishme...
Definition: open62541.c:19906
#define UA_NS0ID_SERVER_SERVERCAPABILITIES_SERVERPROFILEARRAY
Definition: open62541.h:2553
size_t availableSequenceNumbersSize
Definition: open62541.h:3996
#define UA_STATUSCODE_BADIDENTITYTOKENINVALID
Definition: open62541.h:687
#define PRODUCT_URI
Definition: open62541.c:27599
#define UA_fd_set(fd, fds)
Definition: open62541.c:26769
#define UA_alloca(SIZE)
Definition: open62541.h:113
UA_String name
Definition: open62541.h:1289
#define UA_NS0ID_SERVER_SERVERCAPABILITIES
Definition: open62541.h:2552
struct UA_NotificationMessageEntry UA_NotificationMessageEntry
#define AGAIN
Definition: open62541.c:26789
#define UA_STATUSCODE_BADBROWSEDIRECTIONINVALID
Definition: open62541.h:737
#define UA_STRING_STATIC(s)
Definition: open62541.c:27603
#define TAILQ_FOREACH_SAFE(var, head, field, tvar)
Definition: open62541.c:466
#define UA_STATUSCODE_GOODLOCALOVERRIDE
Definition: open62541.h:822
UA_Byte u8
Definition: open62541.c:773
#define SLIST_HEAD(name, type)
Definition: open62541.c:119
#define UA_TYPES_SERVERSTATE
Definition: open62541.h:4125
#define LIST_INSERT_HEAD(head, elm, field)
Definition: open62541.c:251
#define UA_TRANSPORT_SECURECONVERSATIONMESSAGEABORTBODY
Definition: open62541.c:2530
MonitoredItemCreateRequest ^^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4735
UA_ConnectionState
Connection Structure ^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:9462
void(* UA_Logger)(UA_LogLevel level, UA_LogCategory category, const char *msg, va_list args)
The signature of the logger.
Definition: open62541.h:9654
ModifyMonitoredItemsResponse ^^^^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4759
UA_SecurityTokenRequestType
SecurityTokenRequestType ^^^^^^^^^^^^^^^^^^^^^^^^ Indicates whether a token if being created or renew...
Definition: open62541.h:3765
#define UA_NS0ID_HASEVENTSOURCE
Definition: open62541.h:1831
#define UA_NS0ID_SERVER_SERVERDIAGNOSTICS
Definition: open62541.h:2556
#define UA_STATUSCODE_BADSECURITYPOLICYREJECTED
Definition: open62541.h:745
UA_STATIC_ASSERT(sizeof(UA_MessageType)==sizeof(UA_Int32), enum_must_be_32bit)
#define UA_NS0ID_CLOSESESSIONREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2071
#define UA_STATUSCODE_BADINVALIDSTATE
Definition: open62541.h:870
size_t messageSizeSoFar
Definition: open62541.c:3227
#define UA_STATUSCODE_BADCONDITIONALREADYENABLED
Definition: open62541.h:825
#define UA_NS0ID_DIAGNOSTICINFO
Definition: open62541.h:1820
#define UA_NS0ID_SERVER_GETMONITOREDITEMS
Definition: open62541.h:2769
#define UA_STATUSCODE_BADFILTERLITERALINVALID
Definition: open62541.h:733
#define UA_STATUSCODE_BADARGUMENTSMISSING
Definition: open62541.h:788
#define UA_STATUSCODE_UNCERTAINSUBSTITUTEVALUE
Definition: open62541.h:817
UA_Double maxAge
Definition: open62541.h:4801
#define UA_STATUSCODE_BADNODATAAVAILABLE
Definition: open62541.h:872
#define UA_STATUSCODE_UNCERTAINDEPENDENTVALUECHANGED
Definition: open62541.h:860
UA_StatusCode Service_AddNodes_existing(UA_Server *server, UA_Session *session, UA_Node *node, const UA_NodeId *parentNodeId, const UA_NodeId *referenceTypeId, const UA_NodeId *typeDefinition, UA_InstantiationCallback *instantiationCallback, UA_NodeId *addedNodeId)
Definition: open62541.c:21677
UA_NodeId referenceTypeId
Definition: open62541.h:4440
UA_UInt32 * arrayDimensions
Definition: open62541.h:3360
#define UA_TYPES_OBJECTTYPEATTRIBUTES
Definition: open62541.h:3745
UA_StatusCode UA_Array_copy(const void *src, size_t size, void **dst, const UA_DataType *type)
Definition: open62541.c:5773
#define UA_STATUSCODE_BADATTRIBUTEIDINVALID
Definition: open62541.h:708
UA_Double samplingInterval
Definition: open62541.h:3676
UA_MonitoringMode monitoringMode
Definition: open62541.h:4389
#define UA_THREAD_LOCAL
Definition: open62541.c:766
#define UA_TYPES_CREATESESSIONREQUEST
Definition: open62541.h:5050
ContentFilterElementResult ^^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:3525
#define UA_TYPES_BROWSEPATHTARGET
Definition: open62541.h:3257
UA_UInt32 attributeId
Definition: open62541.h:3634
#define UA_TYPES_NODETYPEDESCRIPTION
Definition: open62541.h:5105
#define UA_DATETIME_UNIX_EPOCH
Definition: open62541.h:1078
UA_UInt32 messageTypeAndChunkType
Definition: open62541.c:2629
#define UA_STATUSCODE_BADINVALIDTIMESTAMP
Definition: open62541.h:690
#define LIST_FOREACH(var, head, field)
Definition: open62541.c:219
void Service_Write(UA_Server *server, UA_Session *session, const UA_WriteRequest *request, UA_WriteResponse *response)
Definition: open62541.c:21159
#define UA_TYPES_OBJECTATTRIBUTES
Definition: open62541.h:4431
BrowseDescription ^^^^^^^^^^^^^^^^^ A request to browse the the references from a node...
Definition: open62541.h:4437
#define UA_NS0ID_BASEVARIABLETYPE
Definition: open62541.h:1850
#define UA_NodeStore_newMethodNode()
Definition: open62541.c:3992
#define UA_STATUSCODE_BADCERTIFICATEURIINVALID
Definition: open62541.h:677
#define UA_NS0ID_MODELLINGRULETYPE
Definition: open62541.h:1857
#define UA_STATUSCODE_BADTCPSECURECHANNELUNKNOWN
Definition: open62541.h:798
#define UA_NS0ID_SERVERSTATUSTYPE
Definition: open62541.h:2527
UA_StatusCode UA_Client_deleteNode(UA_Client *client, const UA_NodeId nodeId, UA_Boolean deleteTargetReferences)
Definition: open62541.c:25676
#define UA_NS0ID_READREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2229
#define UA_NS0ID_EXPANDEDNODEID
Definition: open62541.h:1813
struct session_list_entry session_list_entry
#define UA_RESTRICT
Non-aliasing pointers
Definition: open62541.h:163
#define UA_STATUSCODE_BADFILTEROPERATORINVALID
Definition: open62541.h:728
#define UA_TYPES_QUERYDATADESCRIPTION
Definition: open62541.h:5062
void Service_ModifyMonitoredItems(UA_Server *server, UA_Session *session, const UA_ModifyMonitoredItemsRequest *request, UA_ModifyMonitoredItemsResponse *response)
int __secs_to_tm(long long t, struct tm *tm)
Definition: open62541.c:26330
#define UA_NS0ID_BYTE
Definition: open62541.h:1798
UA_StatusCode UA_Client_deleteReference(UA_Client *client, const UA_NodeId sourceNodeId, const UA_NodeId referenceTypeId, UA_Boolean isForward, const UA_ExpandedNodeId targetNodeId, UA_Boolean deleteBidirectional)
Definition: open62541.c:25645
#define UA_STATUSCODE_BADCONFIGURATIONERROR
Definition: open62541.h:809
#define UA_STATUSCODE_BADTOOMANYMONITOREDITEMS
Definition: open62541.h:670
status(* UA_encodeBinarySignature)(const void *UA_RESTRICT src, const UA_DataType *type)
Definition: open62541.c:5868
void Service_RegisterNodes(UA_Server *server, UA_Session *session, const UA_RegisterNodesRequest *request, UA_RegisterNodesResponse *response)
Definition: open62541.c:23297
UA_UInt16 binaryEncodingId
Definition: open62541.h:1664
size_t arrayDimensionsSize
Definition: open62541.h:1404
UA_Boolean userExecutable
Definition: open62541.c:3511
UA_SubscriptionAcknowledgement * subscriptionAcknowledgements
Definition: open62541.h:4482
void Service_Republish(UA_Server *server, UA_Session *session, const UA_RepublishRequest *request, UA_RepublishResponse *response)
UA_String targetServerUri
Definition: open62541.h:4618
UA_Int32 localizedText
Definition: open62541.h:1597
UA_BrowseResult * results
Definition: open62541.h:5140
#define UA_NS0ID_MODELLINGRULE_OPTIONAL
Definition: open62541.h:1860
UA_TimestampsToReturn timestampsToReturn
Definition: open62541.h:4802
#define UA_NS0ID_HASCHILD
Definition: open62541.h:1829
union UA_NodeId::@0 identifier
#define UA_NS0ID_OBJECTTYPESFOLDER
Definition: open62541.h:1866
#define UA_TYPES_DATETIME
DateTime ^^^^^^^^.
Definition: open62541.h:3163
UA_ReadValueId itemToMonitor
Definition: open62541.h:4736
UA_ResponseHeader responseHeader
Definition: open62541.h:4774
UA_Client * UA_Client_new(UA_ClientConfig config)
Definition: open62541.c:24702
#define UA_STATUSCODE_BADDATATYPEIDUNKNOWN
Definition: open62541.h:671
UA_UsernamePasswordLogin usernamePasswords[2]
Definition: open62541.c:27610
#define UA_NS0ID_REPUBLISHREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2424
#define UA_TYPES_SETPUBLISHINGMODERESPONSE
Definition: open62541.h:4595
#define UA_TYPES_MONITORINGMODE
Definition: open62541.h:3437
#define UA_TYPES_REFERENCEDESCRIPTION
Definition: open62541.h:4581
#define UA_TYPES_ADDREFERENCESREQUEST
Definition: open62541.h:4793
UA_DataChangeTrigger
DataChangeTrigger ^^^^^^^^^^^^^^^^^.
Definition: open62541.h:3778
UA_MonitoredItemType
Definition: open62541.c:3831
#define UA_TYPES_VARIABLETYPEATTRIBUTES
Definition: open62541.h:4257
QueryFirstResponse ^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4970
#define UA_TYPES_APPLICATIONDESCRIPTION
Definition: open62541.h:4917
UA_ReadValueId * nodesToRead
Definition: open62541.h:4804
UA_MonitoringMode monitoringMode
Definition: open62541.h:4737
struct UA_SessionManager UA_SessionManager
UA_ExpandedNodeId targetId
Definition: open62541.h:3253
RepublishRequest ^^^^^^^^^^^^^^^^.
Definition: open62541.h:4452
#define UA_STATUSCODE_BADTCPNOTENOUGHRESOURCES
Definition: open62541.h:800
UA_StatusCode statusCode
Definition: open62541.h:4264
#define UA_TYPES_USERTOKENPOLICY
Definition: open62541.h:4350
UA_NotificationMessage notificationMessage
Definition: open62541.h:4726
#define UA_NS0ID_NUMBER
Definition: open62541.h:1821
#define UA_STATUSCODE_UNCERTAINENGINEERINGUNITSEXCEEDED
Definition: open62541.h:820
enum UA_Job::@4 type
#define UA_STATUSCODE_BADFILTERNOTALLOWED
Definition: open62541.h:724
UA_RequestHeader requestHeader
Definition: open62541.h:4068
DataChangeNotification ^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4505
const char * LogCategoryNames[6]
Definition: open62541.c:27545
UA_UInt32 sendSequenceNumber
Definition: open62541.c:3241
const UA_DataType UA_TYPES[UA_TYPES_COUNT]
Definition: open62541.c:12133
UA_BuildInfo buildInfo
Definition: open62541.h:4833
UA_UInt32 sequenceNumber
Definition: open62541.c:2618
#define UA_TYPES_XMLELEMENT
XmlElement ^^^^^^^^^^.
Definition: open62541.h:3181
UA_NodeId * nodesToRegister
Definition: open62541.h:3972
#define UA_TRUE
Definition: open62541.h:923
#define UA_STRING_ALLOC(CHARS)
Definition: open62541.h:1060
#define UA_TYPES_DIAGNOSTICINFO
DiagnosticInfo ^^^^^^^^^^^^^^.
Definition: open62541.h:3235
#define UA_TYPES_CREATEMONITOREDITEMSREQUEST
Definition: open62541.h:4953
#define UA_TYPES_DELETEMONITOREDITEMSRESPONSE
Definition: open62541.h:3949
#define UA_STATUSCODE_BADWAITINGFORINITIALDATA
Definition: open62541.h:705
void Service_Browse_single(UA_Server *server, UA_Session *session, struct ContinuationPointEntry *cp, const UA_BrowseDescription *descr, UA_UInt32 maxrefs, UA_BrowseResult *result)
Definition: open62541.c:22726
UA_UInt32 numeric
Definition: open62541.h:1175
#define UA_EMPTY_ARRAY_SENTINEL
Definition: open62541.h:1389
PublishResponse ^^^^^^^^^^^^^^^.
Definition: open62541.h:3993
UA_RelativePath relativePath
Definition: open62541.h:5016
UA_StatusCode __UA_Client_readAttribute(UA_Client *client, const UA_NodeId *nodeId, UA_AttributeId attributeId, void *out, const UA_DataType *outDataType)
Definition: open62541.c:25869
#define UA_TYPES_CREATEMONITOREDITEMSRESPONSE
Definition: open62541.h:4690
UA_NodeId * registeredNodeIds
Definition: open62541.h:4306
UA_UserTokenType
UserTokenType ^^^^^^^^^^^^^ The possible user token types.
Definition: open62541.h:4051
UA_ConnectionState state
Definition: open62541.h:9479
UA_StatusCode UA_copy(const void *src, void *dst, const UA_DataType *type)
Definition: open62541.c:5684
UA_UInt32 serverIndex
Definition: open62541.h:1241
UA_LocalizedText displayName
Definition: open62541.h:3604
UA_String endpointUrl
Definition: open62541.c:4741
UA_StatusCode UA_Server_delayedCallback(UA_Server *server, UA_ServerCallback callback, void *data)
Definition: open62541.c:18304
#define UA_malloc(_p_size)
UA_Variant * outputArguments
Definition: open62541.h:3450
void UA_deleteMembers(void *p, const UA_DataType *type)
Definition: open62541.c:5750
#define UA_STATUSCODE_BADTYPEDEFINITIONINVALID
Definition: open62541.h:760
UA_UserTokenPolicy * userIdentityTokens
Definition: open62541.h:5075
#define UA_STATUSCODE_BADNODATA
Definition: open62541.h:836
BrowseRequest ^^^^^^^^^^^^^ Browse the references for one or more nodes from the server address space...
Definition: open62541.h:5000
UA_StatusCode UA_Connection_receiveChunksBlocking(UA_Connection *connection, UA_ByteString *chunks, UA_Boolean *realloced, UA_UInt32 timeout)
Definition: open62541.c:14981
#define UA_STATUSCODE_UNCERTAINNOCOMMUNICATIONLASTUSABLEVALUE
Definition: open62541.h:815
UA_StatusCode UA_Server_write(UA_Server *server, const UA_WriteValue *value)
The following node attributes cannot be changed once a node has been created:
Definition: open62541.c:21182
#define UA_STATUSCODE_BADFILTEROPERANDINVALID
Definition: open62541.h:731
#define UA_TRANSPORT_TCPMESSAGEHEADER
Definition: open62541.c:2633
#define UA_MAXCONTINUATIONPOINTS
Definition: open62541.c:3707
NodeTypeDescription ^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:5098
struct UA_DiagnosticInfo UA_DiagnosticInfo
DiagnosticInfo ^^^^^^^^^^^^^^ A structure that contains detailed error and diagnostic information ass...
#define UA_TYPES_REGISTERNODESRESPONSE
Definition: open62541.h:4309
#define UA_TYPES_DELETENODESREQUEST
Definition: open62541.h:3987
#define UA_FUNC_ATTR_WARN_UNUSED_RESULT
Definition: open62541.h:178
#define MAX_PROFILEARRAY
UA_Double requestedSessionTimeout
Definition: open62541.h:5046
#define UA_TYPES_CALLRESPONSE
Definition: open62541.h:4704
#define UA_STATUSCODE_BADHISTORYOPERATIONUNSUPPORTED
Definition: open62541.h:783
#define UA_STATUSCODE_BADAPPLICATIONSIGNATUREINVALID
Definition: open62541.h:748
#define TAILQ_INSERT_TAIL(head, elm, field)
Definition: open62541.c:502
BrowsePathResult ^^^^^^^^^^^^^^^^ The result of a translate opearation.
Definition: open62541.h:4263
#define UA_BUILTIN_TYPES_COUNT
Definition: open62541.h:916
#define UA_STATUSCODE_BADREQUESTTOOLARGE
Definition: open62541.h:660
struct pcg_state_setseq_64 pcg32_random_t
#define UA_TYPES_ENDPOINTDESCRIPTION
Definition: open62541.h:5080
OpenSecureChannelRequest ^^^^^^^^^^^^^^^^^^^^^^^^ Creates a secure channel with a server...
Definition: open62541.h:4288
#define UA_OPEN62541_VER_PATCH
Definition: open62541.h:41
#define UA_TYPES_NODEATTRIBUTESMASK
Definition: open62541.h:3423
#define UA_NS0ID_FOLDERTYPE
Definition: open62541.h:1849
#define UA_STATUSCODE_BADNOTWRITABLE
Definition: open62541.h:714
UA_NODE_BASEATTRIBUTES UA_Boolean isAbstract
Definition: open62541.c:3545
UA_Double minimumSamplingInterval
Definition: open62541.c:3468
UA_BrowseResult * results
Definition: open62541.h:5114
AddReferencesRequest ^^^^^^^^^^^^^^^^^^^^ Adds one or more references to the server address space...
Definition: open62541.h:4787
UA_NodeStore * nodestore
Definition: open62541.c:4223
#define UA_TYPES_QUERYFIRSTRESPONSE
Definition: open62541.h:4982
#define UA_STATUSCODE_BADREQUESTNOTALLOWED
Definition: open62541.h:854
UA_ByteString password
Definition: open62541.h:4026
#define UA_STATUSCODE_BADDECODINGERROR
Definition: open62541.h:658
#define UA_MSEC_TO_DATETIME
Definition: open62541.h:1074
void UA_SecureChannel_attachSession(UA_SecureChannel *channel, UA_Session *session)
Definition: open62541.c:15221
#define UA_STATUSCODE_BADMAXAGEINVALID
Definition: open62541.h:780
#define STARTCHANNELID
Definition: open62541.c:18640
UA_RequestHeader requestHeader
Definition: open62541.h:3330
uint32_t UA_StatusCode
Definition: open62541.h:1011
#define UA_TYPES_CONTENTFILTERELEMENT
Definition: open62541.h:4890
#define TAILQ_HEAD(name, type)
Definition: open62541.c:432
#define UA_STATUSCODE_BADNOENTRYEXISTS
Definition: open62541.h:842
UA_MessageType
MessageType ^^^^^^^^^^^ Message Type and whether the message contains an intermediate chunk...
Definition: open62541.c:2574
#define UA_STATUSCODE_BADCERTIFICATEUSENOTALLOWED
Definition: open62541.h:678
UA_Boolean moreNotifications
Definition: open62541.h:3998
#define UA_STATUSCODE_BADMONITORINGMODEINVALID
Definition: open62541.h:720
UA_UInt32 maxChunkCount
Definition: open62541.h:9454
UA_ConnectionState UA_Client_getConnectionState(UA_Client *client)
Definition: open62541.c:24750
#define FLOAT_INF
Definition: open62541.c:6177
#define UA_TYPES_SETMONITORINGMODEREQUEST
Definition: open62541.h:4394
UA_UInt32 nodeClassMask
Definition: open62541.h:4442
#define UA_TYPES_NODEID
NodeId ^^^^^^.
Definition: open62541.h:3187
UA_StatusCode UA_ByteString_allocBuffer(UA_ByteString *bs, size_t length)
Definition: open62541.c:4945
size_t endpointDescriptionsSize
Definition: open62541.c:4215
UA_StatusCode * results
Definition: open62541.h:4847
ModifySubscriptionResponse ^^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4275
UA_Boolean historizing
Definition: open62541.h:3364
size_t dimensionsSize
Definition: open62541.h:1347
UnregisterNodesResponse ^^^^^^^^^^^^^^^^^^^^^^^ Unregisters one or more previously registered nodes...
Definition: open62541.h:4400
struct UA_Job::@5::@7 methodCall
UA_ViewDescription view
Definition: open62541.h:5002
PublishRequest ^^^^^^^^^^^^^^.
Definition: open62541.h:4479
#define UA_NS0ID_SERVER_NAMESPACEARRAY
Definition: open62541.h:2539
#define UA_NS0ID_SERVER_GETMONITOREDITEMS_INPUTARGUMENTS
Definition: open62541.h:2770
UA_Boolean builtin
Definition: open62541.h:1658
UA_Int32 namespaceUri
Definition: open62541.h:1596
UA_AsymmetricAlgorithmSecurityHeader serverAsymAlgSettings
Definition: open62541.c:3237
MonitoredItemModifyRequest ^^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4012
#define UA_STATUSCODE_BADDOMINANTVALUECHANGED
Definition: open62541.h:859
#define SIMPLEQ_INSERT_TAIL(head, elm, field)
Definition: open62541.c:326
UA_UInt32 timeoutHint
Definition: open62541.h:3306
#define UA_STATUSCODE_BADEVENTIDUNKNOWN
Definition: open62541.h:827
int64_t UA_Int64
Int64 ^^^^^ An integer value between -9 223 372 036 854 775 808 and 9 223 372 036 854 775 807...
Definition: open62541.h:979
#define UA_TYPES_CREATESUBSCRIPTIONRESPONSE
Definition: open62541.h:4637
#define UA_STATUSCODE_BADNODEIDREJECTED
Definition: open62541.h:754
#define UA_TYPES_EXPANDEDNODEID
ExpandedNodeId ^^^^^^^^^^^^^^.
Definition: open62541.h:3193
UA_ResponseHeader responseHeader
Definition: open62541.h:4276
CreateMonitoredItemsResponse ^^^^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4682
#define UA_TYPES_CONTENTFILTERRESULT
Definition: open62541.h:4608
#define UA_TYPES_DATATYPEATTRIBUTES
Definition: open62541.h:3895
void Service_BrowseNext(UA_Server *server, UA_Session *session, const UA_BrowseNextRequest *request, UA_BrowseNextResponse *response)
Definition: open62541.c:22941
UA_NodeId referenceTypeId
Definition: open62541.h:4616
#define LIST_REMOVE(elm, field)
Definition: open62541.c:258
#define UA_TYPES_BROWSERESULTMASK
Definition: open62541.h:3294
#define UA_STATUSCODE_BADAGGREGATEINVALIDINPUTS
Definition: open62541.h:851
#define UA_TRANSPORT_TCPERRORMESSAGE
Definition: open62541.c:2568
void Service_SetPublishingMode(UA_Server *server, UA_Session *session, const UA_SetPublishingModeRequest *request, UA_SetPublishingModeResponse *response)
#define UA_TYPES_ADDNODESRESULT
Definition: open62541.h:3344
#define UA_PRINTF_STRING_FORMAT
Definition: open62541.h:9731
MonitoredItemNotification ^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:3840
#define UA_STATUSCODE_BADNODEIDINVALID
Definition: open62541.h:706
BrowsePathTarget ^^^^^^^^^^^^^^^^ The target of the translated path.
Definition: open62541.h:3252
size_t nodesToReadSize
Definition: open62541.h:4803
const UA_VariableTypeNode * getVariableNodeType(UA_Server *server, const UA_VariableNode *node)
Definition: open62541.c:17871
#define UA_NS0ID_SERVERSTATE
Definition: open62541.h:2444
ModifySubscriptionRequest ^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4326
#define UA_STATUSCODE_BADCONDITIONBRANCHALREADYCONFIRMED
Definition: open62541.h:832
ModifyMonitoredItemsRequest ^^^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4528
void UA_Connection_detachSecureChannel(UA_Connection *connection)
Definition: open62541.c:15008
UA_UInt32 recvBufferSize
Definition: open62541.h:9452
size_t resultsSize
Definition: open62541.h:4698
#define UA_STATUSCODE_BADSHUTDOWN
Definition: open62541.h:665
#define CHECK_ATTRIBUTES(TYPE)
Definition: open62541.c:21934
UA_LocalizedText description
Definition: open62541.h:3958
UA_StatusCode errorCode
Definition: open62541.c:3229
AnonymousIdentityToken ^^^^^^^^^^^^^^^^^^^^^^ A token representing an anonymous user.
Definition: open62541.h:3552
#define UA_TYPES_OPENSECURECHANNELRESPONSE
Definition: open62541.h:4091
UA_StatusCode(* UA_EditNodeCallback)(UA_Server *, UA_Session *, UA_Node *, const void *)
Definition: open62541.c:4260
#define LIST_ENTRY(type)
Definition: open62541.c:205
UA_StatusCode UA_SessionManager_init(UA_SessionManager *sm, UA_Server *server)
Definition: open62541.c:18831
UA_String policyId
Definition: open62541.h:4343
#define UA_STATUSCODE_BADCONDITIONALREADYSHELVED
Definition: open62541.h:833
#define UA_NODE_BASEATTRIBUTES
Definition: open62541.c:3359
#define UA_NS0ID_CALLREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2310
#define UA_TRANSPORT_COUNT
Every type is assigned an index in an array containing the type descriptions.
Definition: open62541.c:2518
LocalizedText ^^^^^^^^^^^^^ Human readable text with an optional locale identifier.
Definition: open62541.h:1313
UA_Boolean hasSourceTimestamp
Definition: open62541.h:1570
#define UA_STATUSCODE_BADTCPMESSAGETYPEINVALID
Definition: open62541.h:797
#define UA_TYPES_BUILDINFO
Definition: open62541.h:3801
#define UA_TYPES_GETENDPOINTSRESPONSE
Definition: open62541.h:5092
CallRequest ^^^^^^^^^^^.
Definition: open62541.h:3590
UA_ChannelSecurityToken nextSecurityToken
Definition: open62541.c:3235
#define UA_STATUSCODE_UNCERTAINLASTUSABLEVALUE
Definition: open62541.h:816
#define LIST_FIRST(head)
Definition: open62541.c:214
void UA_MoniteredItem_SampleCallback(UA_Server *server, UA_MonitoredItem *monitoredItem)
UA_RequestHeader requestHeader
Definition: open62541.h:4289
ContentFilterElement ^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4884
union UA_Job::@5 job
#define UA_TRANSPORT_SEQUENCEHEADER
Definition: open62541.c:2622
#define UA_STATUSCODE_BADCERTIFICATEISSUERUSENOTALLOWED
Definition: open62541.h:679
#define UA_STATUSCODE_BADENDOFSTREAM
Definition: open62541.h:871
UA_StatusCode UA_Server_removeRepeatedJob(UA_Server *server, UA_Guid jobId)
Definition: open62541.c:18257
#define UA_TYPES_QUALIFIEDNAME
QualifiedName ^^^^^^^^^^^^^.
Definition: open62541.h:3205
UA_LocalizedText displayName
Definition: open62541.h:4424
#define UA_TYPES_IDTYPE
Definition: open62541.h:4045
#define UA_NS0ID_BROWSEREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2125